#include <stdio.h> #include <stdlib.h> #define MAX_QUEUE_SIZE 100 typedef int element; typedef struct { element queue[MAX_QUEUE_SIZE]; int front; int rear; }queryType; void error(char *message){ fprintf(stderr,"%s\n", message); exit(1); } void init(queryType *q) { q->front = q->rear = 0; } int isEmpty(queryType *q) { return (q->front == q->rear); } int isFull(queryType *q) { return ( (q->rear+1) % (MAX_QUEUE_SIZE) == q->front); //checking if front is ascended rear = means rear arrived to unused queue cell, full } void enqueue(queryType *q ,element item) { if(isFull(q)) { error("Queue is full\n"); } q->rear = (q->rear+1) % MAX_QUEUE_SIZE;//simply it means next cell q->queue[q->rear] = item; } element dequeue(queryType *q) { if(isEmpty(q))//get into the block if the result is true { error("Queue is empty\n"); } q->front = (q->front+1) % MAX_