线性表----数组
1.C语言表示
(1)字符串类型
#define MAXSIZE 100
typedef struct{
char a[MAXSIZE+1];
int n;
}sqlist;
(2)结构体表示!
#define MAXSIZE 100
struct student{
int num;
char name[20];
char sex;
int age;
float score;
};
typedef struct{
struct student s[maxsize];
int n;
}sqlit;
(3)计算元素的地址
![计算元素的地址](https://img-blog.csdnimg.cn/20190830091021669.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzOTE5MjQ5,size_16,color_FFFFFF,t_70)
公式:loc(a1)+(n-1)*len
例子:![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830091448677.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzOTE5MjQ5,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190830091501956.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzOTE5MjQ5,size_16,color_FFFFFF,t_70)