E37 Answer

12
8
-1

Comments: The keyword static is used to make the actual data that implements the stack hidden from code outside the file stack.c.

static int stack[stackSize];

/* top indexes the item at the top of the stack */
static int top = -1;

The only way a function from another file can use the stack is through the functions, which have external linkage, and thus are visible to the linker. Other files must include prototypes for these functions. A convenient way to do this is to include the header file stack.h.

/* --- stack.h --- */
void push( int item );
int pop();
int empty();
int full();