Skip to content
Snippets Groups Projects

add function stack_push

Merged richarda.tyarks requested to merge 5-add-push-function into main
1 file
+ 0
5
Compare changes
  • Side-by-side
  • Inline
+ 0
5
@@ -18,11 +18,6 @@ void stack_destroy(stack *s) {
@@ -18,11 +18,6 @@ void stack_destroy(stack *s) {
void stack_push(stack *s, int value)
void stack_push(stack *s, int value)
{
{
if (s->top == s->capacity-1)
{
assert(s->data = realloc(s->capacity * 2 * sizeof(int)) && "Error : realloc failed");
}
s->top++;
s->top++;
s->data[s->top] = value;
s->data[s->top] = value;
}
}
Loading