p11(Circular Queue Using Linked List)
p11(Circular Queue Using Linked List)
#include<stdio.h>
#include<stdlib.h>
struct queue
int info;
};
else
rear =new_node;
void QDelete()
ptr=front;
if(front == NULL && rear == NULL)
else
if(front == rear)
front=rear=NULL;
free (ptr);
else
front=front->link;
rear->link=front;
printf("\n The value being deleted is: %d", ptr -> info);
free (ptr);
void Display()
else
do
{
}while(ptr != front);
void main()
do
printf("\n 1. Insert");
printf("\n 2. Delete");
printf("\n 3. Display");
printf("\n 4. Exit");
scanf("%d", &choice);
switch(choice)
case 1:
printf("\n Enter the number to insert into Queue : "); scanf("%d", &val);
QInsert(val);
break;
case 2:
QDelete();
break;
case 3:
Display();
break;
}
}while (choice!=4);
}
OUTPUT