algorithm popStack (ref stack
ref dataout
This algorithm pops the item on the top of the stack and returns it to the user.
Pre stack is metadata structure to a valid stack
dataout is a reference variable to receive the data
post data have been returned to calling algorithm
Return true if successful; false if memory underflow
1 if (stack empty)
1 success = false
2 else
1 dltptr = Stack.top
2 dataout = stack.top->data
3 stack.top = stack.top->next
4 stack.count = stack.count – 1
5 recycle (dltptr)
6 success = true
3 end if
4 return success