diff --git a/stack.c b/stack.c index fc4205b03f83906530ccc57a6e49d70d1683bb95..0c1c9eef7d337bf50b479bca1c6181ca115ba417 100644 --- a/stack.c +++ b/stack.c @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <stdbool.h> #include "stack.h" @@ -75,3 +76,13 @@ int get_length(stack s) { return s.top + 1; } +/** + * @brief Check if a stack is empty + * + * @param s + * @return bool - true if stack is empty, false otherwise + */ +bool stack_is_empty(stack s) +{ + return s.top == -1; +} \ No newline at end of file