24 lines
451 B
C
Executable File
24 lines
451 B
C
Executable File
#ifndef stack_defined
|
|
#define stack_defined
|
|
|
|
typedef union stack_element_t {
|
|
int i;
|
|
double d;
|
|
} stack_element_t;
|
|
|
|
typedef struct stack_t {
|
|
int top;
|
|
stack_element_t elements[256];
|
|
} stack_t;
|
|
|
|
int pushInt(stack_t *stack, int value);
|
|
int pushDouble(stack_t *stack, double value);
|
|
|
|
int popInt(stack_t *stack, int *value);
|
|
int popDouble(stack_t *stack, double *value);
|
|
|
|
#define ensure(stack) (stack->top<255)
|
|
#define empty(stack) (!stack->top)
|
|
|
|
#endif
|