#include #include int main (int argc, char **argv) { struct List { int elem; struct List *next; }; struct List *list, *tmp; list = NULL; tmp = malloc (sizeof (struct List)); if (!tmp) { fprintf (stderr, "%s: Out of memory!\n", argv[0]); exit (1); } tmp->elem = 4; tmp->next = NULL; list = tmp; tmp = malloc (sizeof (struct List)); if (!tmp) { fprintf (stderr, "%s: Out of memory!\n", argv[0]); exit (1); } tmp->elem = 5; tmp->next = NULL; list->next = tmp; tmp = list; while (tmp) { printf ("The next list element is %d\n", tmp->elem); tmp = tmp->next; } return 0; }