/*------------------------------------------------------------------*/ /* teststackao.c */ /*------------------------------------------------------------------*/ #include #include #include "stackao.h" int main(int argc, char *argv[]) /* Test the Stack abstract object. */ { double d1 = 1.1; double d2 = 2.2; double d3 = 3.3; double *pd; /* Use a Stack of strings. */ Stack_init(); Stack_push("Ruth"); Stack_push("Gehrig"); Stack_push("Mantle"); Stack_push("Jeter"); while (! Stack_isEmpty()) printf("%s\n", (char*)Stack_pop()); Stack_free(); /* Use a Stack of doubles. */ Stack_init(); Stack_push(&d1); Stack_push(&d2); Stack_push(&d3); while (! Stack_isEmpty()) { pd = (double*)Stack_pop(); printf("%g\n", *pd); } Stack_free(); return 0; }