Skip to content
Snippets Groups Projects

Resolve "Add clear function"

Merged orestis.malaspin requested to merge 13-add-clear-function into main
All threads resolved!
Files
2
+ 11
4
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include "stack.h"
@@ -87,4 +83,15 @@ int get_length(stack s) {
bool stack_is_empty(stack s)
{
return s.top == -1;
}
/**
* @brief Reset the stack's top to -1
* New values will overwrite the old ones
*
* @param s
*/
void stack_clear(stack *s)
{
s->top = -1;
}
\ No newline at end of file
Loading