Linked List - JohnHau/mis GitHub Wiki

image image

image

image

image

image

image

image

image image

image

image

Sample Linked List Implementation Example

#include<stdio.h> #include<stdlib.h>

int main() { //node structure struct node { int data; struct node *next; };

//declaring nodes struct node *head,*middle,*last;

//allocating memory for each node head = malloc(sizeof(struct node)); middle = malloc(sizeof(struct node)); last = malloc(sizeof(struct node));

//assigning values to each node head->data = 10; middle->data = 20; last->data = 30;

//connecting each nodes. head->middle->last head->next = middle; middle->next = last; last->next = NULL;

//temp is a reference for head pointer. struct node *temp = head;

//till the node becomes null, printing each nodes data while(temp != NULL) { printf("%d->",temp->data); temp = temp->next; } printf("NULL");

return 0; }

⚠️ **GitHub.com Fallback** ⚠️