#include<iostream>using namespace std;#define MAX_SIZE 100#define EORROR 0#define OK 1typedef int Elem_Type;typedef int Status;typedef struct sqlist{Elem_Type n = 0;Elem_Type Elem_array[MAX_SIZE];size_t length=0;}SqList;Status Init_SqList(SqList *L){L->Elem_array = (Elem_Type*)malloc(MAX_SIZE*sizeof(Elem_Type)); \\這里有錯(cuò)if (!L->Elem_array){L->length = 0;return OK;}elsereturn EORROR;}
1 回答

HUX布斯
TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超6個(gè)贊
Elem_Type Elem_array[MAX_SIZE];已經(jīng)是數(shù)組了,你還給他申請(qǐng)內(nèi)存
要么定義Elem_Type *Elem_array;要么別malloc給他申請(qǐng)內(nèi)存
你見過定義了 int array[10];還給他申請(qǐng)內(nèi)存嗎array=new int[10];
- 1 回答
- 0 關(guān)注
- 178 瀏覽
添加回答
舉報(bào)
0/150
提交
取消