#include <stdio.h> //标准头文件,提供宏va_start,va_arg,va_end,用于存取变长参数表
#include <stdlib.h>
#include <stdarg.h>
#define TRUE 1
#define FALSE 0
#define ERROR 0
#define OVERFLOW -1
#define OK 1
#define INFEASIBLE -2
#define MAX_ARRAY_DIM 8 //假设数组最大维数为8
#define UNDERFLOW -1
typedef int Status;
//数组的物理存储结构
typedef struct
{
ElemType *base; //数组元素基址,有InitArray分配
int dim; //数组维数
int *bounds; //数组维数基址
int *constants; //数组映像函数基址
}
//数组的基本操作
Status InitArray(Array &A,int dim,……)
{
//若维数dim和随后的各维长度合法,则构造相应的数组A,并返回OK
if(dim<1||dim>MAX_ARRAY_DIM)
return ERROR;
A.dim=dim;
A.bounds=(int*)malloc(sizeof(int)*dim);
if(!A.bounds)
数据结构之数组16定义及实现
最新推荐文章于 2022-11-13 16:46:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)