-1
0
1
2
3
4
5
6
7
8
9
front
rear

Front of the Queue :

Rear of the Queue :

Last Queued Item :

Last Dequeued Item :

Size of the Queue :

This is a message box

ENQUEUE ALGORITHM

void enqeue(int x){
if(front==-1){
front=0;
}
if(rear==size-1){
printf("QUEUE OVERFLOW");
}
else{
rear++;
queue[rear]=x;
}
}

DEQUEUE ALGORITHM

int dequeue(){
int x;
if(front==-1 || rear==-1 || front>rear){
printf("QUEUE UNDERFLOW");
}
else{
x=queue[front];
front++;
}
return x;
}