数据结构malloc函数问题
程序代码:
#include<stdio.h> #include<malloc.h> #define STACK_INIT_SIZE 100; #define STACKINCREMENT 10; #define ERROR 0 #define OK 1 #define OVERFLOW 0 typedef int SElemType; typedef int Status; typedef struct{ SElemType *base; SElemType *top; int stacksize; }SqStack; Status InitStack(SqStack *S); Status InitStack(SqStack *S) { (*S).base=(SElemType*)malloc(STACK_INIT_SIZE*sizeof(SElemType)); if(!(*S).base) exit(OVERFLOW);//存储分配失败 (*S).top=(*S).base; (*S).stacksize=STACK_INIT_SIZE; return OK; }//InitStack int main() { SqStack S; if(InitStack(&S)) printf("已加载空栈!"); }
我想知道哪儿错了?