程序出现declaration syntax error,哪位高手帮忙解决一下,不胜感激!程序如下:(栈表达式求值)

来源:百度知道 编辑:UC知道 时间:2024/05/24 18:29:33
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
#define OK 1
#define ERROR 0
#define OVERFLOW 0
typedef struct
{char *base;
char *top;
int stacksize;
}SqStack;
SqStack InitStack(SqStack S)
{ S.base=(char *)malloc(STACK_INIT_SIZE*sizeof(char));
if(!S.base) exit(OVERFLOW);
S.top=S.base;
S.stacksize=STACK_INIT_SIZE;
return S;
}
SqStack Push(SqStack S,char e)
{ if(S.top-S.base>=STACK_INIT_SIZE)
{ S.base=(char *)realloc(S.base,(S.stacksize+STACKINCREMENT)*sizeof

(char));
if(!S.base) exit(OVERFLOW);
S.top=S.base+S.stacksize;
S.stacksize+=STACKINCREMENT;
}
*S.top++=e;
return S;
}
char GetTop(SqStack S)
{ if(S.top==S.base) return ERROR;
return *(S.top-1);
}
char Pop(SqStack S,char e)
{
if(S.top=

你程序的第87行:

int OperandType EvaluateExpression()

被报告了申明错误,因为这行不符合函数申明的格式,函数申明的格式一般如下:

类型 函数名([参数]){}

你int作为类型,OperandType和EvaluateExpression两个单词作为函数名,这是不允许的,只能有一个单词。