Preview:
#include <stdio.h>
#define MAX 5

int q[MAX];
int front = -1, rear = -1;

// Enqueue
void enqueue(int x){
    if(rear == MAX-1){
        printf("Overflow\n");
        return;
    }
    if(front == -1) front = 0;
    q[++rear] = x;
    printf("Inserted %d\n", x);
}

// Dequeue
void dequeue(){
    if(front == -1 || front > rear){
        printf("Underflow\n");
        return;
    }
    printf("Deleted %d\n", q[front++]);
}

// Display
void display(){
    if(front == -1 || front > rear){
        printf("Queue is empty\n");
        return;
    }
    for(int i=front;i<=rear;i++)
        printf("%d ", q[i]);
    printf("\n");
}

int main(){
    int ch, x;

    do{
        printf("\n1.Enqueue 2.Dequeue 3.Display 4.Exit\n");
        scanf("%d",&ch);

        switch(ch){
            case 1: scanf("%d",&x); enqueue(x); break;
            case 2: dequeue(); break;
            case 3: display(); break;
        }
    }while(ch!=4);

    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter