⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stack.h

📁 this is very good for teacher
💻 H
字号:
#ifndef _STACK_H_#define _STACK_H_#define STACK_INITIAL_SIZE	256/* Do NOT manipulate the __stack structure directly unless you know what * you are doning. */struct __stack{	char *base;	unsigned int size;	char *top;};typedef struct __stack STACK;#ifdef __cplusplusextern "C"{#endifSTACK *stack_create(unsigned int isize);#define stack_push(stack, elem, type) \({																			\	(stack)->top + sizeof (type) <= (stack)->base + (stack)->size ||		\		__stack_expand(stack, sizeof (type)) >= 0 ?							\	*((type *)(stack)->top)++ = (elem), (stack)->top - (stack)->base : -1;	\})#define stack_pop(stack, type)	(*--(type *)(stack)->top)#define stack_top(stack, type)	(*((type *)(stack)->top - 1))#define stack_height(stack)		((stack)->top - (stack)->base)#define stack_empty(stack)		((stack)->base == (stack)->top)void stack_destroy(STACK *stack);/* Never call the following function directly. */int __stack_expand(STACK *stack, unsigned int esize);#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

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