This tutorial demonstrate how to implement circular linked list.

Tutorials

This tutorial demonstrate how to implement circular linked list.

## Description:

In the circular linked list the link of lat node is connected to the first node.

## Code:

```# include <stdio.h>
# include <stdlib.h>
struct node
{
int data;
};
struct node *insert(struct node *p , int n)
{
struct node *temp;

if(p==NULL)
{
p=(struct node *)malloc(sizeof(struct node));
if(p==NULL)
{
printf("Error Occurred\n");
exit(0);
}
p-> data = n;
}
else
{
temp = p;
temp-> link =  (struct node *)malloc(sizeof(struct node));
{
printf("Error Occurred\n");
exit(0);
}
temp-> data = n;
}
return (p);
}
void printlist ( struct node *p  )
{
struct node *temp;
temp = p;
printf("The data in the list are :\n");
if (p!= NULL)
{  do
{
printf("%d\t",temp-> data);
}while(temp!=p);
}
else
}
void main()
{
int num;
int value;
struct node *start = NULL ;
printf("Enter the number of nodes to be created \n");
scanf("%d",&num);
while ( num-- > 0 )
{
printf( "Enter the data to be placed in a node\n");
scanf("%d",&value);
start = insert ( start , value );
}
printlist ( start );
}```