From cda5d12376fe4e5c7bda2c5fd4bc8d00631f06b8 Mon Sep 17 00:00:00 2001 From: "guoguo.yu" <guoguo.yu@hes-so.ch> Date: Tue, 21 Dec 2021 13:57:28 +0100 Subject: [PATCH] is_empty --- queue.c | 6 ++++++ queue.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/queue.c b/queue.c index 4ebd3f3..0cd78af 100644 --- a/queue.c +++ b/queue.c @@ -1 +1,7 @@ #include "queue.h" + +bool is_empty(queue q){ + if (q.tail<0) return true; + else return false; +} + 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