Click on stack_with_delete.c to get source.
/* File: CExamples/OO_pgm_in_C_new/stack_with_delete.c */
/* generic printstack */
#include "stack_with_delete.h"
#include <stdio.h>
void print_stack(stack s)
/* print the stack; note that this function should work
independently of the underlying data structure, i.e.,
it is a generic function */
{stackptr s2ptr; /* store the popped elements */
int i;
s2ptr = (*s.clone)(&s );
printf("Stack contents: ");
while( !(*s2ptr->is_empty)(s2ptr) )
{i = (*s2ptr->pop)(s2ptr);
printf("%2d ", i);
};
printf(" bottom\n"); fflush(stdout);
(*s2ptr->delete_stack)(s2ptr);
}/* end print_stack */