Untitled
unknown
plain_text
a year ago
896 B
0
Indexable
Never
#include <stdio.h> #include <stdlib.h> struct node { int data; struct node *link; }; int main() { struct node *head = (struct node *)malloc(sizeof(struct node)); head->data = 3; head->link = NULL; struct node *current = (struct node *)malloc(sizeof(struct node)); current->data = 4; current->link = NULL; head->link = current; current = (struct node *)malloc(sizeof(struct node)); current->data = 2; current->link = NULL; head->link->link = current; current = (struct node *)malloc(sizeof(struct node)); current->data = 8; current->link = NULL; head->link->link->link = current; current = (struct node *)malloc(sizeof(struct node)); current->data = 8; current->link = NULL; head->link->link->link->link = current; printf("%d", head->data); return 0; }