开发者社区> 问答> 正文

vs2010中怎么经常报错!求助 !

#include
#include
#define STACK_SIZE 100
char contents[STACK_SIZE];
int top=0;
void make_empty(void);
int is_empty(void);
void stack_underflow(void);
void stack_overflow(void);
void push(char i);
int pop(void);
int is_full(void);
int main()
{
char a,c;
printf("Enter parenteses and/or braces:");
for(;;){
c=getchar();
if(c=='\n'){
    if(top==0){
        printf("匹配!\n");break;}
    else{
        printf("不匹配!\n");break;}}
else if(c=='{'||c=='('||c=='[')
    push(c);
else if(c=='}'||c==')'||c==']'){
    a=pop();
    if((c=='}' && a!='{')||(c==')' && a!='(')||(c==']' && a!='[')){
        printf("不匹配!!\n");break;}
else{
    printf("输入不正确");break;}}
}
void make_empty(void)
{
top=0;
}
int is_empty(void)
{
if(top==0)
return 1;
else
return 0;
}
int is_full(void)
{
if(top==STACK_SIZE)
return 1;
else
return 0;
}
void push(char i)
{
if(is_full())
stack_overflow();
else
contents[top++] = i;
}
int pop(void)
{
if (is_empty())
stack_underflow();
else
return contents[--top];
}
void stack_overflow(void)
{
printf("Stack Overflow\n");
printf("bupipei\n");
exit (0);
}
void stack_underflow(void)
{
printf("Stack Underflow\n");
exit (0);
}
1>c:\users\lenovo\documents\visual studio 2010\projects\20141126.c\20141126.c\596.c(42): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)

展开
收起
a123456678 2016-03-19 17:48:03 2216 0
1 条回答
写回答
取消 提交回答
  • 你的main部分少了右花括号"}"加上就可以了。

    2019-07-17 19:08:25
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载