#include #define MAXSTACKSIZE 100 double stack[MAXSTACKSIZE]; /* stack "pointer" -- "points" to the top value */ int sp = 0; /* push a value onto the stack */ void push( double value ) { if ( sp < MAXSTACKSIZE ) { /* stack[sp++] = value; */ stack[sp] = value; sp++; } else { printf( "ERROR: Stack is full.\n" ); } } /* pop and return top value from the stack */ double pop() { if ( sp > 0 ) { /* return stack[--sp]; */ sp--; return stack[sp]; } else { printf( "ERROR: Stack is empty\n" ); } }