लिंक्ड लिस्ट डायनामिक मेमोरी एलोकेशन का उपयोग करती हैं और नोड्स का संग्रह होती हैं।
नोड्स के दो भाग होते हैं जो डेटा और लिंक हैं।
लिंक्ड लिस्ट के प्रकार
C प्रोग्रामिंग भाषा में लिंक्ड लिस्ट के प्रकार निम्नलिखित हैं:
- सिंगल / सिंगली लिंक्ड लिस्ट
- डबल / डबली लिंक्ड लिस्ट
- सर्कुलर सिंगल लिंक्ड लिस्ट
- सर्कुलर डबल लिंक्ड लिस्ट
सिंगल लिंक्ड लिस्ट
नीचे दिया गया आरेख सिंगल लिंक्ड लिस्ट के प्रतिनिधित्व को दर्शाता है।

उदाहरण
निम्नलिखित C प्रोग्राम सिंगल लिंक्ड लिस्ट का उपयोग करके संख्याओं को रिवर्स क्रम में प्रदर्शित करने के लिए है:
#include <stdio.h> #include <stdlib.h> struct node { int num; struct node *nextptr; }*stnode; void createNodeList(int n); void reverseDispList(); void displayList(); int main(){ int n; printf("\n\n single Linked List : print it in reverse order :\n"); printf("------------------------------------------------------------------------------\n"); printf(" Input the number of nodes : "); scanf("%d", &n); createNodeList(n); printf("\n Data entered in the list are : \n"); displayList(); reverseDispList(); printf("\n The list in reverse are : \n"); displayList(); return 0; } void createNodeList(int n){ struct node *fnNode, *tmp; int num, i; stnode = (struct node *)malloc(sizeof(struct node)); if(stnode == NULL) { printf(" Memory can not be allocated."); } else{ // कीबोर्ड के माध्यम से नोड के लिए डेटा पढ़ता है printf(" Input data for node 1 : "); scanf("%d", &num); stnode-> num = num; stnode-> nextptr = NULL; tmp = stnode; // n नोड्स बनाता है और लिंक्ड लिस्ट में जोड़ता है for(i=2; i<=n; i++){ fnNode = (struct node *)malloc(sizeof(struct node)); if(fnNode == NULL) { printf(" Memory can not be allocated."); break; } else{ printf(" Input data for node %d : ", i); scanf(" %d", &num); fnNode->num = num; fnNode->nextptr = NULL; tmp->nextptr = fnNode; tmp = tmp->nextptr; } } } } void reverseDispList(){ struct node *prevNode, *curNode; if(stnode != NULL){ prevNode = stnode; curNode = stnode->nextptr; stnode = stnode->nextptr; prevNode->nextptr = NULL; // प्रथम नोड को अंतिम में बदलें while(stnode != NULL){ stnode = stnode->nextptr; curNode->nextptr = prevNode; prevNode = curNode; curNode = stnode; } stnode = prevNode; // अंतिम नोड को हेड में बदलें } } void displayList(){ struct node *tmp; if(stnode == NULL){ printf(" No data found in the list."); } else{ tmp = stnode; while(tmp != NULL){ printf(" Data = %d\n", tmp->num); tmp = tmp->nextptr; } } }आउटपुट
जब उपरोक्त प्रोग्राम निष्पादित होता है, तो यह निम्नलिखित परिणाम उत्पन्न करता है:
Single Linked List : print it in reverse order : ------------------------------------------------------------------------------ Input the number of nodes : 5 Input data for node 1 : 12 Input data for node 2 : 45 Input data for node 3 : 11 Input data for node 4 : 9 Input data for node 5 : 10 Data entered in the list are : Data = 12 Data = 45 Data = 11 Data = 9 Data = 10 The list in reverse are : Data = 10 Data = 9 Data = 11 Data = 45 Data = 12