[anton@notebook tmp]$ cat main.c #include #include typedef struct item { int data; struct item *next; } item; int main() { struct item *first = NULL; struct item *tmp; int n; while (scanf("%d", &n)!= EOF) { tmp = (item *)malloc(sizeof(item)); tmp->data = n; tmp->next = first; first = tmp; } tmp = first; while (tmp != NULL) { printf("%d", tmp->data); tmp = tmp->next; } return 0; } [anton@notebook tmp]$ gcc main.c -o main [anton@notebook tmp]$ ./main 1 2 3 4 5 54321[anton@notebook tmp]$