Write down the function to insert an element into a queue, in which the queue isimplemented as an array.

Q – Queue

X – element to added to the queue Q IsFull(Q)
– Checks and true if Queue Q is full Q->Size – Number of elements in the queue Q Q->Rear – Points to last element of the queue Q Q->Array – array used to store queue elements void
enqueue (int X, Queue Q) {

Error (“Full queue”);
else {


Q->Rear = Q->Rear+1;

Q->Array[ Q->Rear ]=X;



Leave a Reply