#include #include #include typedef struct node { int number; struct node *next; } node; int main(void) { node *list = NULL; // Create list for (int i = 0; i < 3; i++) { int x = get_int("Number: "); node *n = malloc(sizeof(node)); if (n == NULL) { return 1; } n->number = x; n->next = list; list = n; } // Print list node *ptr = list; while (ptr != NULL) { printf("%i\n", ptr->number); ptr = ptr->next; } // Free memory ptr = list; while (ptr != NULL) { node *tmp = ptr; ptr = ptr->next; free(tmp); } }