how to create linked list?

Recommended Answers

All 7 Replies

The most simplifying method is a structures.
Like that

struct Node
{
    int value; //data of node
    Node *next; //pointer to a next node in the list
};

struct List
{
   Node *first;
   Node *last;
};

Implementation you will type by yourself. Good luck!

commented: Seems like a good start to such a terse question +36

LinkedList

SUMMARY: In computer science, a linked list is a data structure that consists of a sequence of data records such that in each record there is a field that contains a reference (i.e., a link) to the next record in the sequence.

A linked list is a data structure in which it contains the nodes. a node is a structure it contains the data field and a pointer field. the data field can be anything, and the pointer field contains the address of the next node.

so the structure should be
struct Single_Linked_List
{
char name[20];// data
int rollno;// data
float fee;// data
struct Single_Linked_List *next;// pointer to the next node
};
typedef struct Single_Linked_List SLL;
now SLL can be used whereever structure can be used.
SLL *Newnode;

You are right, Gaity. Don't forget to post source code with bb code tags. Read announcement[b/] link at the top for each forum page.

Please let me know what is bb tags, and how to use that.
thanks,
Gaiety

Please let me know what is bb tags, and how to use that.
thanks,
Gaiety

Read the material at this link:

http://www.daniweb.com/forums/thread93280.html

On the front page of this forum, there are a number of threads at the top which as a "newbie", you should read as well.

how to write c programming containing linked list of students consisting of name age roll no in he ascending order of name

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.