word
数据结构
第一、二次上机:
#include stdio.h
#include malloc.h
#include stdlib.h
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define list_init_size 100 //线性表存储空间的初始分配量
#define LISTINCREMENT 10 //线性表存储空间的分配增量
typedef int Status;
typedef int ElemType;
typedef struct{
ElemType *elem; int length; int listsize; }SqList;
//存储空间基址
//当前长度
//当前分配的存储容量〔以
sizeof(ElemType) 为单位〕
Status InitList_Sq(SqList L){
//构造一个空的线性表 L
L.elem =(ElemType * )malloc(list_init_size*sizeof(ElemType));
if(!L.elem )exit(OVERFLOW);//
原创力文档

文档评论(0)