#include<stdio.h>
#include<stdlib.h>
#include <assert.h>// 断言
//下面是数组堆栈的宏 函数依次是 判空 判满 压入 置顶 输出
#define generic_stack(stack_type,suffix,stack_size) \
static stack_type stack##suffix[stack_size]; \
static int top_element##suffix=-1; \
int is_empty##suffix() \
{ \
return top_element##suffix==-1; \
} \
void is_full##suffix() \
{ \
return top_element##suffix==stack_size-1; \
} \
int push##suffix(stack_type value) \
{ \
assert(!is_full##suffix()); \
top_element##suffix+=1; \
详细解决方案
数组堆栈的宏?解决思路
热度:1404 发布时间:2013-02-26 00:00:00.0
相关解决方案