Skip to content
Snippets Groups Projects
Commit 4089d1f2 authored by ines.maya's avatar ines.maya
Browse files

fait avec is empty

parent 8d8794f1
No related branches found
No related tags found
1 merge request!16Resolve "Add pop function"
This commit is part of merge request !16. Comments created here will be created in the context of that merge request.
// depile
void stack_pop(stack *s, int *value){
assert(s->top>=0 && "Stcak is empty\n");
if (stack_is_empty(*s)){
printf("stack is empty\n");
return;
}
if (s->top == s->capacity/4){
s->capacity /= 2;
s->data = realloc(s->data, sizeof(int)*s->capacity);
}
*value = s->data[s->top];
s->top -= 1;
}
\ No newline at end of file
stack.h 0 → 100644
void stack_pop(stack *s, int *value);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment