####问题发生背景:数据结构顺序栈的初始化失败
####错误信息:S->base=(SElemType)malloc(MAXSIZEsizeof(SElemType));
```c
typedef struct
{
int example;
}SElemType;
typedef struct
{
SElemType *base;
SElemType *top;
int stacksize;
}SqStack;
int main()
{
Status InitStack(SqStack *S);
SqStack *S;
InitStack(S);
printf("%o",S->base);
}
Status InitStack(SqStack *S)
{
S->base=(*SElemType)malloc(MAXSIZE*sizeof(SElemType));
if(!S->base) exit(OVERFLOW);
S->top=S->base;
S->stacksize=MAXSIZE;
return OK;
}
详细报错:[Error] expected expression before 'SElemType'
尝试方法:通过调试定位报错语句,最后发现是S->base编译系统无法理解,但S->表示指针所指向的结构体成员变量,语法上是可行的,百思不得其解。
###希望各位掌握相关知识的友友不吝赐教