From b9625bf10e9870ae44c6222024d75d26c4245042 Mon Sep 17 00:00:00 2001 From: Josenaldo Date: Thu, 3 Oct 2019 22:33:03 -0300 Subject: [PATCH] Fix bug in the 'isFull' function The topIndex field equals to the number of elements in the stack minus one --- stack/stack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack/stack.c b/stack/stack.c index b5ffa0a..6203ae0 100644 --- a/stack/stack.c +++ b/stack/stack.c @@ -29,7 +29,7 @@ bool isEmpty(Stack *stack) bool isFull(Stack *stack) { - if (stack->topIndex == (int) stack->capacity) + if (stack->topIndex == (int) stack->capacity - 1) return true; else return false;