Skip to content
Snippets Groups Projects
Commit cac83986 authored by richarda.tyarks's avatar richarda.tyarks
Browse files

capacity is never changed

parent 6b2c9fc5
No related branches found
No related tags found
1 merge request!7add function stack_push
This commit is part of merge request !7. Comments created here will be created in the context of that merge request.
......@@ -17,9 +17,9 @@ void stack_destroy(stack *s) {
void stack_push(stack *s, int value)
{
if (s->top == s->capacity-1)
if (s->top == DEFAULT_CAPACITY-1)
{
assert(s->data = realloc(s->capacity * 2 * sizeof(int)));
assert(s->data = realloc(DEFAULT_CAPACITY * 2 * sizeof(int)));
}
s->top++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment