1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Operator stack_full (Stack s) -> int
Pre
s is a valid stack
Post
returns True if s is full, otherwise
returns False
End

Operator stack_empty (Stack s) -> int
Pre
s is a valid stack
Post
returns True if there are no elements
in s, otherwise False
End

Operator stack_peek (Stack s) -> int
Pre
s is a valid stack
Post
returns top element of s,
s is left unchanged
End

Now that we have the specification, we can turn our attention to the implementation

First we need to define the Stack type, and declare the stack module functions, this will be done in the stack.h include file

*

*

March 1, 1999

Page 12

C201/TAM