What does the following project write to the monitor?
/* --- stack.h --- */ void push( int item ); int pop(); int empty(); int full();
/* --- stack.c --- */
#define stackSize 16
static int stack[stackSize];
/* top is the top of the stack */
static int top = -1;
void push( int item )
{
top++ ;
stack[top] = item;
}
int pop()
{
int item;
item = stack[top];
top--;
return item;
}
int empty()
{
return top == -1;
}
int full()
{
return top == stackSize;
}
/* --- mainStack.c --- */
#include <stdio.h>
#include "stack.h"
int main()
{
if ( !full() ) push( 13 );
if ( !full() ) push( -1 );
if ( !full() ) push( 8 );
if ( !full() ) push( 12 );
if ( !empty() ) printf("%d\n", pop() );
if ( !empty() ) printf("%d\n", pop() );
if ( !empty() ) printf("%d\n", pop() );
}