版权声明: https://blog.csdn.net/shuiyixin/article/details/82999605
报错信息
报错代码
L->elem = (ElemType *)malloc(LISTMAXSIZE * sizeof(SqList));
L是一个顺序表的实例,一般情况定义线性表不会使用指针,这次尝试使用指针过程中报错。
typedef struct {
ElemType * elem;
int length;
int ListSize;
}*SqList;
Sqlist L;
解决方案
修改L的类型:
typedef struct {
ElemType * elem;
int length;
int ListSize;
} SqList;
SqList L;