/*-------------------------------------------------------------------*/ /* teststack.c (Version 5: Opaque Pointers) */ /*-------------------------------------------------------------------*/ #include "stack.h" #include int main(int argc, char *argv[]) { Stack_T oStack1; Stack_T oStack2; oStack1 = Stack_new(10); Stack_push(oStack1, 1.1); Stack_push(oStack1, 2.2); while (! Stack_empty(oStack1)) printf("%g\n", Stack_pop(oStack1)); Stack_free(oStack1); oStack2 = Stack_new(20); Stack_push(oStack2, 3.3); Stack_push(oStack2, 4.4); while (! Stack_empty(oStack2)) printf("%g\n", Stack_pop(oStack2)); Stack_free(oStack2); return 0; } /* Output: 2.2 1.1 4.4 3.3 */