#include #include typedef struct ListNode { int data; struct ListNode *next; } ListNode; int main() { printf("Hello World!! \n"); printf("next line\n"); ListNode *head = NULL; for (int i = 0; i < 5; i++) { ListNode *temp = (ListNode *) malloc(sizeof(ListNode)); (*temp).data = i; //not typcically the way we do this temp->next = head; head = temp; } ListNode *p = head; while (p != NULL) { printf("data is %d\n", p->data); p = p->next; } //removes all the nodes while (head != NULL) { p = head; head = head->next; free(p); } printf("after delete\n"); p = head; while (p != NULL) { printf("data is %d\n", p->data); p = p->next; } return 0; }