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!
2 files
+ 16
4
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 11
4
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include "stack.h"
#include "stack.h"
@@ -87,4 +83,15 @@ int get_length(stack s) {
@@ -87,4 +83,15 @@ int get_length(stack s) {
bool stack_is_empty(stack s)
bool stack_is_empty(stack s)
{
{
return s.top == -1;
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