Skip to content
Snippets Groups Projects

Resolve "Add is empty function"

Merged orestis.malaspin requested to merge 10-add-is-empty-function into main
1 file
+ 11
0
Compare changes
  • Side-by-side
  • Inline
+ 11
0
#include <stdlib.h>
#include <stdlib.h>
 
#include <stdbool.h>
#include "stack.h"
#include "stack.h"
@@ -75,3 +76,13 @@ int get_length(stack s) {
@@ -75,3 +76,13 @@ int get_length(stack s) {
return s.top + 1;
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
Loading