Home Article Practice 线性表的顺序表示

线性表的顺序表示

2023-11-08 22:37  views:485  source:小键人丸子头    

//顺序表的存储结构
#define MAXSIZE 100 //顺序表可能达到的最大长度
typedef struct
{
ElemType *elem; //存储空间的基地址
int length; //当前长度
}Sqlist; //顺序表的结构类型为Sqlist
例:
#define MAXSIZE 100 //多项式可能达到的最大长度
typedef struct //多项式非零的定义
{
float coef; //系数
int expn; //指数
}Polynomial;
typedef struct
{
polynomial *elem; //存储空间的基地址
int length; //多项式中当前项的个数
}Sqlist; //多项式的顺序存储结构类型为Sqlist
例:
#define MAXSIZE 1000 //图书表可能达到的最大长度
typedef struct
{
char no[20]; //图书ISBN
char name[50]; //图书名字
float prince; //图书价格
}Book;
typedef struct
{
Book *elem; //存储空间的基地址
int length; //图书表中当前图书个数
}Sqlist; //图书表的顺序存储结构类型为Sqlist



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)