首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

使用泛型数组堆栈总报错揭示unexpected end of file found

2013-11-03 
使用泛型数组堆栈总报错提示unexpected end of file found主程序g_stack.c如下#include g_stack.h#inclu

使用泛型数组堆栈总报错提示unexpected end of file found
主程序g_stack.c如下


#include "g_stack.h"
#include <STDIO.H>
#include <STDLIB.H>

GENERIC_STACK(int,_int,10)
GENERIC_STACK(float,_float,5)

int main()
{
push_int(5);
push_int(22);
push_int(15);
push_float(25.3);
push_float(-40.3);
while(!is_empty_int())
{
printf("popinf %d\n",top_int());
pop_int();
}

while(is_empty_float())
{
printf("poping %f\n",top_float());
pop_float();
}
return EXIT_SUCCESS;
}

自己编写的头文件g_stack.h如下
#include <ASSERT.H>

#define GENERIC_STACK(STACK_TYPE,SUFFIX,STACK_SIZE)     \
staticSTACK_TYPE stack##SUFFIX[STACK_SIZE];   \
staticinttop_element##SUFFIX = -1;       \
int is_empty##SUFFIX(void)                      \
{\
return top_element##SUFFIX == -1;\
}                                                \
int is_full##SUFFIC(value)                       \
{                                                \
return top_element##SUFFIX == STACK_SIZE-1;      \
}                                                \
void push##SUFFIX(STACK_TYPE value)              \
{                                                \
assert(!is_full##SUFFIX());                      \
top_element##SUFFIX += 1;                        \
stack##SUFFIX[top_element##SUFFIX] = value       \
}                                                \
void pop##SUFFIX(void)                           \
{                                                \
assert(!is_empty##SUFFIX());                     \
top_element##SUFFIX -=1;                         \
}                                                \
                                                         \
STACK_TYPE top##SUFFIX(void)                     \
{                                                \
assert(!is_empty##SUFFIX());                     \
return stack##SUFFIX[top_element##SUFFIX];       \
}                                                        \



求大神帮忙找下出错位置。 C语音 泛型数组堆栈 unexpected?end 调试
[解决办法]
最后一行的  "" 不需要的了!
注意 ""后面不要留空格!
[解决办法]
该回复于2013-11-03 08:55:48被管理员删除

热点排行