C Programming language

adplus-dvertising
C - Circular Linked List
Previous Home Next

In Circular Linked List, the list element are arranged in the same way as in the singly linked list having only one difference that the last element of the circular linked list always point to the first node of the list i.e. it means that last node does not point to NULL.

In other words, we can say that the circular list is a list which does not have an end. Thus, it is necessary in case of circular linked to establish the first node and last node. It is useful if we set external pointer i.e. head to point to the last node in the list.

We declare the structure for the circular linked list in the same way as we declare it for the singly or linear linked lists.

#include <stdio.h>
struct node
{
int num;
node*next;
};
typedef struct node NODE;
NODE *head,*first,*last;
Previous Home Next