1 /* c1
h (程序名 ) */#include #include #include /* malloc() 等 */#include /* INT _MAX 等 */#include /* EOF(=^Z 或 F6),NULL */#include /* atoi() */#include /* eof() */#include /* floor(),ceil(),abs() */#include /* exit() *//* 函数结果状态代码*/#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define INFEASIBLE -1/* #define OVERFLOW -2 因为在 math
h 中已定义 OVERFLOW的值为 3,故去掉此行*/typedef int Status; /* Status 是函数的类型 ,其值是函数结果状态代码,如OK 等 */typedef int Boolean; /* Boolean 是布 尔类型 ,其值是 TRUE 或 FALSE */2 /* algo2-1
c 实现算法 2
1 的程序*/#include"c1
h"typedef int ElemType; #include"c2-1
h"/*c2-1
h 线性表的动态分配顺序存储结构*/#define LIST_INIT_SIZE 10 /* 线性表存储空间的初始分配量*/#define LISTINCREMENT 2/* 线性表存储空间的分配增量*/typedef struct{ ElemType *elem ; /* 存储空间基址*/int length; /* 当前长度*/int listsize; /* 当前分配的存储容量(以 sizeof(ElemType)为单位 ) */}SqList;