#include <stdio.h>
#define STACK_SIZE 30
static int stack[STACK_SIZE]
static size_t stack_ptr = 0;
void push(int value)
{
#ifdef TRACE
printf("pushing: %c\n", value);
#endif
if (stack_ptr == STACK_SIZE)
printf("Stack is full\n");
else
stack[stack_ptr++] = value;
}
int pop(void)
{
if (stack_ptr == 0) {
printf("Stack is empty\n");
return 0;
}
#ifdef TRACE
printf("popping: %c\n", stack[stack_ptr - 1]);
#endif
return stack[--stack_ptr];
}
/* End of File */