Example & Tutorial understanding programming in easy ways.

How traverse the Circular Queue?

Following is the function that are used to traverse the circular Queue from Front to rear:

program-

int display()
{
int f=first,r=rear;
if(f==-1)
{
printf("Queue is Emptyn");
return 0;
}
printf("Queue is :n");
if(f< =r)
while(f< =r)
{
printf("%d ",circular_queue[f]);
f=f+1;
}
else
while(f< =MAX-1)
{
printf("%d ",circular_queue[f]);
f=f+1;
}
f=0;
while(f< =r)
{
printf("%d ",circular_queue[f]);
f=f+1;
}
}




Read More →