#include #include "stack.h" void stack_push(stack_t *stack, int value) { if (stack->size >= stack->capacity) { perror("stack overflow"); exit(EXIT_FAILURE); } stack->data[stack->size++] = value; } int stack_pop(stack_t *stack) { if (stack->size <= 0) { perror("stack_pop: Stack already empty"); exit(EXIT_FAILURE); } return stack->data[--stack->size]; }