急急急!!!declaration syntax error问题

[复制链接]
查看11 | 回复1 | 2009-3-23 08:58:41 | 显示全部楼层 |阅读模式
#include
#include
#define MAX 64
typedef char datatype;
typedef struct

{

datatype data[MAX];

int top;

}seqstack;
/*进栈*/
seqstack *PUSH(seqstack *s,datatype x)

{

if(s->top==MAX-1)

{

printf("Overflow!");

return NULL;

}

else

{

s->top++;

s->data[s->top]=x;

}

return s;

}
/*出栈*/
datatype POP(seqstack *s)

{

if(s->toptop--;

return (s->data[s->top+1]);

}

}
int main

{
/*declaration syntax error*/

seqstack *sq;

datatype A[MAX],x;

char *p;

sq=malloc(sizeof(seqstack));

sq->top=-1;

gets(A);

for(p=A;*p!='\0';p++)

{

if(*p=='(')

PUSH(sq,*p);

else

if(*p==')')

{

x=POP(sq);

if(x!='(')

{

printf("Not match!");

return 0;

}

}

}

if(sq->top==-1)

{

printf("Match!");

return 1;

}

}

回复

使用道具 举报

千问 | 2009-3-23 08:58:41 | 显示全部楼层
int main { /*declaration syntax error*/ //main后面的括号掉了 main()还有#include 应该是#include吧。。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行