}
}
//通不过编译器啊!!!!!!!
数组堆栈的宏
c
------解决方案--------------------未包含stack相关API的声明和实现。
------解决方案--------------------void有return,int无return
------解决方案--------------------漏说了重要的修改,斜杠右边要立即回车,不能有空格、tab等字符,否则要报错。
------解决方案--------------------/*跑了一下在vs2010中编译通过,编译不过的主要问题是宏定义中间不能有空格,函数返回类型不正确,generic_stack(int,_int,10);不能放在main()中*/
#include "stdafx.h"
#include "iostream"
#include "string"
#include "vector"
#include<stdio.h>
#include<stdlib.h>
#include <assert.h>// 断言
using namespace std;
//下面是数组堆栈的宏 函数依次是 判空 判满 压入 置顶 输出
#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; \
} \
int is_full##suffix() /* void 不能有返回值 */ \
{ \
return top_element##suffix==stack_size-1; \
} \
void push##suffix(stack_type value) /* 没有返回值用void */ \
{ \