[C语言由键盘输入10个整数倒序输出]#include <stdio.h> int main() { int numbers[10]; int count; for(count=0;count<=9;count++) { printf("请输入第%d个数:", count); scanf("%d", &numbers[count]); } for(count=...+阅读
#include
#include
struct node
{
int a;
node *next;
};
void output(node *p)
{
if (p != NULL)
{
output(p->next);
printf ("%d ", p->a);
}
}
int main()
{
int a, n;
node *head = NULL, *p;
printf("请输入数字个数:");
scanf("%d", &n);
printf("请输入数字:");
for (int i = 0; i {
scanf("%d", &a);
if (head == NULL)
{
head = (node *)malloc(sizeof(node));
head->a = a;
p = head;
}
else
{
p->next = (node *)malloc(sizeof(node));
p = p->next;
p->a = a;
}
}
p->next = NULL;
printf("倒序输出数字:");
output(head);
printf("\n");
}
以下为关联文档:
C语言输入十个数将其倒序排列使用函数嵌套的方法#include <stdio.h> #define N 5 void input(int [ ], int); void output(int [ ], int); void sort(int [ ], int); int minpos(int [ ], int, int); void swap(int [ ], i...