#ifndef _STACK_H #define _STACK_H #include "list.h" // stack relies on list to work // (which relies on node) struct stack { List *data; // pointer to list containing data Node *top; // pointer to node at top of stack int size; // maximum stack size (0 is unbounded) }; typedef struct stack Stack; // because we deserve nice things Stack *mkstack(int ); // create new stack (of max size) Stack *cpstack(Stack * ); // create a copy of an existing stack Stack *rmstack(Stack * ); // clear and de-allocate an existing stack int push(Stack **, Node * ); // put new node on top of stack int pop (Stack **, Node **); // grab (and disconnect) top node off stack Node *peek(Stack * ); // grab (do not disconnect) top node off stack int isempty(Stack * ); // determine if the stack is empty or not #endif