#include "mydefs2a.h"
#include <assert.h>
// Linked list implementation of stacks.
Istack:: node* Istack :: new_node(int d, node* n)
{ node* t = new node; assert( t ); t -> data = d; t -> next = n; return( t );
}
int Istack :: pop() { assert( !isempty() ); int temp = top -> data; node* oldtop = top; top = top -> next; delete oldtop; return temp;
}
int
node*
top
Linked Stack showing effect of push() and pop() operations