The linked list consist of a series of structures. They are not required to be stored in adjacent memory locations. Each structure consist of a data field and address field. Address field contains the address of its successor.
A variable of the above structure type is conventionally known as a node.
A list consisting of three data x1,x2,x3 is represented using a linked list. Node A stores the data x1 and the address of the successor (next) node B. Node B stores the data x2 and the address of its successor node C. Node C contains the data x3 and its address field is grounded (NULL pointer), indicating it does not have a successor.
Structures in «C» can be used to define a node. Address of the successor node can be stored in a pointer type variable.
typedef struct ListNode
struct ListNode *next;
It is a self referential structure in «C». It is assumed that the type of data to be stored in each node is predefined to be of integer type. Next field of the structure is a pointer type variable, used for storing address of its successor node. Nodes are manipulated during run-time. A programming language must provide following facilities for run time manipulation of nodes.
Acquring memory for storage during run-time.
Freeing memory during execution of the program, once the need for the acquired is over.
In «C» programming language, memory can be acquired through the use of standard library functions malloc() and calloc(). Memory acquired during runtime can be freed through the use of library function free().