stk.h

来自「国外网站上的一些精典的C程序」· C头文件 代码 · 共 65 行

H
65
字号
/*** stk.h - Stack manager (stk.c) header file.**** By Dustin Puryear (dpuryear@intersurf.com), placed into Public Domain.*/#ifndef STK__H#define STK__Htypedef struct stknode{      void           *pdata;      struct stknode *pprev;} StkNode;typedef struct stk{      StkNode        *ptop;      unsigned       vcount;} Stk;/*** stkInit()**** Precondition   - pstack points to a stk type variable.** Postcondition  - Stack pointed to by pstack is initialized.** Returns        - None.*/extern void stkInit(Stk *pstack);/*** stkPush()**** Precondition   - pstack points to an initialized stack.**                  pdata points to data to be stored in stack.** Postcondition  - Data contained in pdata is pushed onto the stack.** Returns        - Non-zero if success, 0 if error.*/extern int stkPush(Stk *pstack, void *pdata);/*** stkPop()**** Precondition   - ppdata points to a pointer to contain data.**                  pstack points to initialized stack.** Postcondition  - Top of stack is pushed into ppdata (pointer).** Returns        - Non-zero if success, 0 if error.*/extern int stkPop(void **ppdata, Stk *pstack);/*** stkCount()**** Precondition   - pstack points to an initialized stack.** Postcondition  - None.** Returns        - Number of items on stack.*/extern unsigned stkCount(Stk *pstack);#endif /* STK__H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?