From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:08:27 +0200 Subject: add: graphs et rushs --- graphs/piscine/fifo/fifo.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 graphs/piscine/fifo/fifo.h (limited to 'graphs/piscine/fifo/fifo.h') diff --git a/graphs/piscine/fifo/fifo.h b/graphs/piscine/fifo/fifo.h new file mode 100644 index 0000000..c4b0a6f --- /dev/null +++ b/graphs/piscine/fifo/fifo.h @@ -0,0 +1,28 @@ +#ifndef FIFO_H +#define FIFO_H + +#include + +struct list +{ + int data; + struct list *next; +}; + +struct fifo +{ + struct list *head; + struct list *tail; + size_t size; +}; + +struct fifo *fifo_init(void); +size_t fifo_size(struct fifo *fifo); +void fifo_push(struct fifo *fifo, int elt); +int fifo_head(struct fifo *fifo); +void fifo_pop(struct fifo *fifo); +void fifo_clear(struct fifo *fifo); +void fifo_destroy(struct fifo *fifo); +void fifo_print(const struct fifo *fifo); + +#endif /* !FIFO_H */ -- cgit v1.2.3