顺序表的初始化

#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <math.h>
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
#define STATUS int
#define ElemType int
#define OK 1;
typedef struct{
ElemType * elem;
int length;
int listsize;
}SqlList;
STATUS initList_Sq(SqlList *l)
{
l->elem=(ElemType )malloc(LIST_INIT_SIZE * sizeof(ElemType));
if(!l->elem) exit(OVERFLOW);
l->length=0;
l->listsize=LIST_INIT_SIZE;
return OK;
}
void mergeList(SqlList la,SqlList lb,SqlList *lc){

}
int main() {
SqlList la ;
initList_Sq(&la);
ElemType *pa = la.elem;
*pa = 1;
pa++;
*pa = 2;
return 0;
}

发表评论

邮箱地址不会被公开。 必填项已用*标注