c program to implement queue operations using array

#define MAX 10
int queue[MAX];
int front =-1,rear=-1;
void insert(void);
int delete_element(void);
int peep(void);
void display(void);
    int option,val;
        printf(“n *******MAIN MENU**********”);
        printf(“n 1.Insert an element”);
        printf(“n 2.Delete an element”);
        printf(“n 3.peep”);
        printf(“n 4.display”);
        printf(“n 5.Exit”);
    printf(“n Enter your optionn”);
        case 1:
            case 2:
            printf(“n The number that was deleted is :%d”,val);
            case 3:
                printf(“n The first value in the queue is:%d”,val);
                case 4:
            return 0;
    void insert()
        int num;
        printf(“n Enter the number to be inserted in the queue n”);
        printf(“n Overflow”);
        if(front==-1 && rear==-1)
    int delete_element()
    int val;
    if (front==-1 || front>rear)
    printf(“n Underflow n”);
    return -1;

    return val;

    int peep()
        return queue[front];
    void display()
        int i;
        printf(“t %d”,queue[i]);

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat