复习的时候随手敲的,可以直接运行,main函数里是我检查结果的,可以自行删去。
如果有地方可以改进可以评论我谢谢!仅供参考
# include <stdio.h>
#include<malloc.h>
#include<stdlib.h>
# define SIZE 10
# define OK 1
# define TRUE 1
# define ERROR 0
# define FALSE 0
#define OVERFLOW -1
#define LIST_INIT_SIZE 100//线性表存储空间的初始分配量
#define LISTINCREMENT 10//线性表初始存储空间的分配增量
typedef int Status;
typedef int ElemType;
typedef struct{
ElemType * elem;//储存空间基地址
int length;//当前表长
int listsize;//当前分配的存储容量(单位为sizeof(ElemType))
}SqList;
Status InitList_Sq(SqList * L);
Status DestroyList_Sq(SqList * L);
Status ClearList_Sq(SqList * L);
Status ListEmpty(SqList L);
int ListLength(SqList L);
Status GetElem(SqList L, int i, ElemType * e);
Status LocateElem(SqList L, ElemType e, Status(*Compare)());
Status PriorElem(SqList L, ElemType cur_e, ElemType * pre_e);
Status NextElem(SqList L, ElemType cur_e, ElemType * next_e);
Status ListInsert_Sq(SqList * L, int