TechArena Community What is a linked list?

#1
28-11-2009
 Member Join Date: Nov 2009 Posts: 51

Hello,
I am T.Y.B.Sc. student. As per our syllabus we have C programming language. I recently started learning C language. In our last tutorial our sir has asked question What is a linked list? I had never heard this type of any term that's why I unable to write it's answer. Please if you have any idea about this term share with me.
#2
28-11-2009
 Member Join Date: May 2008 Posts: 2,293
Re: What is a linked list?

Linked list is a type of datastructure that collect either different type of data or same type of data. These data are basically stored in node. Usually node have non primitive data that are stored in to two parts. One part have data and other part have address of next node.
#3
28-11-2009
 Member Join Date: Oct 2005 Posts: 2,389
Re: What is a linked list?

Linked list is a type of datastructure made up of nodes that collect various data. Each node have two parts one is Information part and other is linked part.
1.Information part=This part contain value of data elements.
In Linked list we stored information linear format.
#4
28-11-2009
 Member Join Date: May 2008 Posts: 2,383
Re: What is a linked list?

A linked list is collection of data in linear format. It consist of nodes. All nodes are linearly connected. The linear format is supported by pointer. You can find linked list in either doubly or liner or circular format.
__________________
The FIFA Manager 2009 PC Game
#5
28-11-2009
 Member Join Date: Feb 2008 Posts: 1,848
Re: What is a linked list?

Here I just given you program to understand linked list.
Code:
```Basic linked list example

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

char *str1;
};

int main(void) {
char line[1024];

while(fgets(line, 1024, stdin) != NULL) {
n->next1 = h;
h = n;

n->str1 = strdup(line);
}

while(h != NULL) {
printf("%s\n", h->str1);
h = h->next1;
}

return 0;
}```
#6
28-11-2009
 Member Join Date: Feb 2009 Posts: 96
Re: What is a linked list?

Since most people tend to always give absolute definitions I'll try to explain it in layman's terms.
a linked list is a list of items that in some way relate to each other to create a kind of data structure that can be read through and manipulated easier. like links of a chain.
example

you can have 2 linked lists that work with each other.
1 can be prices of seats of and airline
and the other can be a list of passengers for the airline and the seat they reserved.

 Tags: