A queue is a First In First Out (FIFO) data structure. This means that the first element inserted will be the first to be processed on the queue. Queues work on the basis of placing an element at the tail (ENQUEUE) and removing an element from the head (DEQUEUE).

Queues are another data structure widely used in programming. An example of queue usage is in case of an event queue in an event driven system such as Windows. The events arriving in the system are placed in a queue and are handled accordingly.
When the mouse is clicked in the Windows OS, it generates a mouse click event. This event is sent to an event queue which passes the element from the head to an event manager which handles the event and performs the necessary operations.
The queue can be easily implemented using our implementation of the linked list. This is because a queue can be considered as a special form of a linked list which allows insertions at the tail (ENQUEUE) and deletions from the head (DEQUEUE). The program has been compiled using gcc 4.4.1. There is a queue_test.c to explain the usage of the stack functions. The program can be compiled using the Makefile by issuing the “make” command on any Linux bash shell.
Download implementation of the queue
Related Posts:
Tags: programs

