From a747903994c7e0bd728bc3dcfd6a5c88b4dc99aa Mon Sep 17 00:00:00 2001 From: "richarda.tyarks" <richard-andre.tyarks@etu.hesge.ch> Date: Thu, 2 Dec 2021 22:40:37 +0100 Subject: [PATCH] now i can feel the force --- stack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stack.c b/stack.c index 880491a..d538b84 100644 --- a/stack.c +++ b/stack.c @@ -17,9 +17,10 @@ void stack_destroy(stack *s) { void stack_push(stack *s, int value) { - if (s->top == DEFAULT_CAPACITY-1) + if (s->top == s->capacity-1) { - assert(s->data = realloc(DEFAULT_CAPACITY * 2 * sizeof(int))); + assert(s->data = realloc(s->capacity * 2 * sizeof(int))); + s->capacity=s->capacity * 2; } s->top++; -- GitLab