libcproject
C static library easier to use than libc (C standard library).
queue.h
Go to the documentation of this file.
1 #ifndef __LIBCPROJECT_QUEUE__
2 #define __LIBCPROJECT_QUEUE__
3 
4 #include <errno.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 
8 #include "types.h"
9 
14 struct queue {
15  struct queue_node *first;
16  size_t length;
17 };
18 
23 struct queue_node {
24  void *data;
25  struct queue_node *next;
26 };
27 
35 
43 void queue_push(struct queue *queue, void *data);
44 
52 void *queue_pop(struct queue *queue);
53 
60 void queue_free(struct queue *queue);
61 
62 #endif
struct queue_node * next
Definition: queue.h:25
size_t length
Definition: queue.h:16
void queue_push(struct queue *queue, void *data)
Push data to queue.
struct queue_node * first
Definition: queue.h:15
void * data
Definition: queue.h:24
void * queue_pop(struct queue *queue)
Pop data from queue.
struct queue * queue_initialization()
Queue initialization.
void queue_free(struct queue *queue)
Frees the queue.
Queue structure => FIFO (First In First Out).
Definition: queue.h:14
Queue node structure.
Definition: queue.h:23