C程序,段错误,哪位高手帮我改改,谢谢。
错误出现在这一句:ST->elem = (ElemType*)malloc(sizeof(ElemType)); #include <stdio.h>#define ERROR -1#define SUCCEED 0//#define EQ(a,b) (!strcmp((a),(b)))typedef int KeyType;typedef struct{ char stu_id[15]; char name[20]; char Chinese[5]; char math[5]; char English[5];}ElemType;typedef struct{ ElemType *elem; int length;}SSTable;int Create(SSTable *ST, int n){ ST->elem = (ElemType*)malloc(sizeof(ElemType)); //错误点 if (NULL == ST->elem) { return ERROR; } else { return SUCCEED; } return 0;}int main(void){ SSTable *ST; Create(ST,5); //printf("%s",ST->elem->stu_id); printf("HELLO\n"); return 0;}