Listing 5 (stack.h) Stack Abstraction Example

#define STACK_SIZE      10

typedef struct  {
       char    *stk_magic;             /* stack magic number */
       int     stk_top;                /* top of stack index */
       void    *stk_stack[STACK_SIZE]; /* actual stack storage */
}       STK;

STK     *StkConstruct();
void    StkDestroy(STK*);
void    StkPush(STK*, void*);
void    *StkPop(STK*);
int     StkIsEmpty(STK*);

/* End of File */