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

*

next we pop the contents of the stack, and show that the correct sequence of integers is produced

finally, we have another chance to test stack_empty and stack_full on what should be an empty stack

the stack is then destroyed, and we check that the correct value is returned

*

*

" http://www.cs.ualberta.ca/~tony/C201/Examples/Stack"to see the example program

int

IMAGE imgs/lec-15.sli03.gif

int

int

int*

typedef struct stack_struct* Stack;

typedef struct stack_struct {
int size;/* The size of the stack */
int top;

};int* ptr;/* The actual stack of data *//* Index of the top of the stack */

March 1, 1999

Page 15

C201/TAM