I could give u an idea how to implement the queue via circular link list.
Assuming
typedef struct node{
int value;
struct node *next
} node;
1) You need to main the address of two pointer to maintain the queue using circular link list.
a. Head --> For releasing the element from the queue.
b. Tail--->For insertion the element in the queue. i.e whose next will be pointing to the first one.
Other things will be depended where will u call these.
2) While inserting the element in the queue.
InsertElementInQueue(node *head,node *tail,int p)
{
allocate the memory for the new node.
newnode->value=i_value;
if (Head == NULL)
{
head = newnode;
newnode->next=head;
tail=head;
}
else
{
newnode->next=head;
tail->next=newnode;
}
return;
}
3) While removing the element from the queue.
RemoveElementInQueue(node *head,node *tail)
{
node *temp;
if (Head == NULL)
{
printf("Queue is already empty\n");
return failue;
}
else
{
printf("Now the turn is for %d",head->value);
if(head != tail)
{
temp=head;
head=head ->next;
}
else
{
temp=head;
head=tail=NULL;
}
free temp;
}
return;
}