#include <stdio.h>
#include <process.h>
#include <malloc.h>
#define OK 1
#define TRUE 1
#define FALSE 0
#define ERROR 0
#define OVERFLOW -2
typedef int Status;
typedef int ElemType;
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct{
ElemType * elem;
int length;
int listsize;
}SqList;
Status InitList(SqList &L) // 算法2.3
{ // 操作结果:构造一个空的顺序线性表
L.elem=(ElemType*)malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(!L.elem)
exit(OVERFLOW); // 存储分配失败
L.length=0; // 空表长度为0
L.listsize=LIST_INIT_SIZE; // 初始存储容量
return OK;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载