//------------------- stack2.h --------------------------- //------------ header file for unit stack ---------------- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // C++ call by reference was used. // in order to succeed compelation, program file // must be save as cpp files. // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ //-------------------- Types & definitions ---------------------------- typedef int stack_info_type; /* or anyt ather data type */ struct link_type { stack_info_type info; struct link_type *next; }; typedef struct link_type * stack_type; //----------------------- Prototypes ---------------------------------- stack_type stack_init (void); void stack_push (stack_type &S, stack_info_type x); stack_info_type stack_pop (stack_type &S); stack_info_type stack_top (stack_type S); int stack_empty (stack_type S); void stack_show (stack_type S) ;