Singly linked list node structure : C Programming
Before doing Singly Linked Operations we need to define structure for Linked List. Structure is collection of different data types in a single unit.
Node Structure for Singly Linked List :
struct node { int data; struct node *next; }start = NULL;
In the above node structure we have defined two fields in structure -
No | Field | Significance |
---|---|---|
1 | data | It is Integer Part for Storing data inside Linked List Node |
2 | next | It is pointer field which stores the address of another structure (i.e node) |
Explanation of Node Structure :
- We have declared structure of type “NODE”, i.e we have created a Single Linked List Node.
- A Node in general language is a Structure having two value containers i.e [Square box having two Partitions]
- One value container stores actual data and another stores address of the another structure i.e (Square box having two partitions)
- We have declared a structure and also created 1 very first structure called “Start”.
- Very first node “Start” contain 1 field for storing data and another field for address of another structure
- As this is very first node or Structure, we have specified its next field with “NULL” value.
[box]NULL means “NOTHING” , if next node is unavailable then initialize variable name to NULL.[/box]
Consider the topmost example of singly linked list which consists of 3 nodes. The actual linked list will be like this -