Claude Chappe' Curse - A C Game
Logo Institut d'Informatique Claude Chappe Logo Université de Le Mans Logo Raeptor Production
 
Loading...
Searching...
No Matches
Queue Data Structure

A simple queue data structure. More...

Classes

struct  Queue
 A node in the queue. More...
 

Functions

bool queue_is_empty (Queue *queue)
 Checks if the queue is empty.
 
void queue_push (Queue *queue, void *data)
 Pushes data onto the queue.
 
void * queue_pop (Queue *queue)
 Pops data from the queue.
 
void queue_free (Queue *queue)
 Frees the queue.
 

Detailed Description

A simple queue data structure.

This module provides a simple queue data structure and functions to manipulate it. The queue is implemented as a singly linked list where each node contains a pointer to the next node and a pointer to the data.

Function Documentation

◆ queue_is_empty()

bool queue_is_empty ( Queue queue)

Checks if the queue is empty.

This function checks if the given queue is empty.

Parameters
queuePointer to the queue to check.
Returns
true if the queue is empty, false otherwise.

◆ queue_push()

void queue_push ( Queue queue,
void *  data 
)

Pushes data onto the queue.

This function adds a new node with the given data to the end of the queue.

Parameters
queuePointer to the queue to push data onto.
dataPointer to the data to be added to the queue.

◆ queue_pop()

void * queue_pop ( Queue queue)

Pops data from the queue.

This function removes the node at the front of the queue and returns the data stored in that node. If the queue is empty, the behavior is undefined.

Parameters
queuePointer to the queue to pop data from.
Returns
Pointer to the data stored in the node that was removed from the queue.

◆ queue_free()

void queue_free ( Queue queue)

Frees the queue.

This function frees all the nodes in the queue. The data stored in the nodes is not freed.

Parameters
queuePointer to the queue to be freed.