29#define STACK_EMPTY (-2147483647 - 1)
void stack_destroy(Stack *s)
Destroy a stack and release its allocated memory.
Definition stack.c:20
int stack_size(const Stack *s)
Get the current number of elements in the stack.
Definition stack.c:47
int stack_pop(Stack *s)
Pop the value at the top of the stack.
Definition stack.c:35
int stack_peek(const Stack *s)
Return the value at the top of the stack without removing it.
Definition stack.c:41
bool stack_push(Stack *s, int value)
Push a value onto the top of the stack.
Definition stack.c:27
Stack * stack_create(int capacity)
Allocate and initialize a new stack.
Definition stack.c:4
bool stack_is_empty(const Stack *s)
Check whether the stack is empty.
Definition stack.c:49
Representation of a stack of integers.
Definition stack.h:37
int * data
Pointer to the dynamically allocated array of integers.
Definition stack.h:38
int capacity
Maximum number of elements the stack can hold.
Definition stack.h:40
int top
Index of the current top element (-1 if empty)
Definition stack.h:39