Skip to content
Snippets Groups Projects

Resolve "Add destroy function"

Merged joey.martig requested to merge 9-add-destroy-function into main
2 files
+ 9
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 7
0
@@ -11,6 +11,13 @@ void stack_init(stack *s)
s->data = malloc(sizeof(int) * DEFAULT_CAPACITY);
}
void stack_destroy(stack *s){
free(s->data);
s->data = NULL;
s->capacity = -1;
s->top = -1;
}
void stack_peek(stack s, int *value){
if (!stack_is_empty(s)) {
*value = s.data[s.top];
Loading