From 436394d687c171e4504ec0a986abe937a4cb3911 Mon Sep 17 00:00:00 2001 From: "guoguo.yu" <guoguo.yu@etu.hesge.ch> Date: Wed, 26 Jan 2022 14:21:31 +0100 Subject: [PATCH] is_empty --- queue.c | 5 +++++ queue.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/queue.c b/queue.c index 4ebd3f3..8ddd127 100644 --- a/queue.c +++ b/queue.c @@ -1 +1,6 @@ #include "queue.h" + +bool is_empty(queue q){ + return (q.tail<0); +} + diff --git a/queue.h b/queue.h index bf57235..12a77cb 100644 --- a/queue.h +++ b/queue.h @@ -1,3 +1,4 @@ +#include <stdbool.h> #ifndef _QUEUE_H_ #define _QUEUE_H_ @@ -6,4 +7,6 @@ typedef struct _queue { int *data; } queue; +bool is_empty(queue q); + #endif -- GitLab