diff --git a/structure of linked list b/structure of linked list new file mode 100644 index 0000000..fa25f84 --- /dev/null +++ b/structure of linked list @@ -0,0 +1,23 @@ +/* Initialize nodes */ +struct node *head; +struct node *one = NULL; +struct node *two = NULL; +struct node *three = NULL; + +/* Allocate memory */ +one = malloc(sizeof(struct node)); +two = malloc(sizeof(struct node)); +three = malloc(sizeof(struct node)); + +/* Assign data values */ +one->data = 1; +two->data = 2; +three->data=3; + +/* Connect nodes */ +one->next = two; +two->next = three; +three->next = NULL; + +/* Save address of first node in head */ +head = one;