69,368
社区成员
发帖
与我相关
我的任务
分享
#define LIST_INIT_SIZE 100 /*线性表存储空间的初始分配量*/
typedef int ElemType;
typedef struct {
ElemType *elem; /*存储空间基址 */
int length; /*当前长度 */
int listsize; /*当前分配的存储容量 */
}Sqlist;
int InitList( Sqlist &L) /*构造一个空的线性表*/ 此处有错误提示
{
L.elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(!L.elem) exit(1); //存储分配失败
L.length=0; // 空表长度为0
L.listsize=LIST_INIT_SIZE; //初始存储容量
return 1;
}