数据结构c语音这代码的输入函数那里的*t是什么意思

#include<stdio.h>
#include<stdlib.h>
#define Max 20
typedef struct air
{
int No;//航班号
char qidian[20];//起飞地点
char zhongdian[20];//到达地点
char feijixinghao[20];//飞机型号
char qifeishijian[20];//起飞时间
char daodashijian[20];//到达时间
}AIR;
struct shunxu
{
AIR a[Max];
int deft;
};
shuru(struct shunxu *t)//输入
{
int x;
printf("请输入多少个航班的信息:\n");
scanf("%d",&(*t).deft);
for(x=0;x<(*t).deft;x++)
{
printf("请输入第%d个航班的航班号:\n",x+1);
scanf("%d",&(*t).a[x].No);
printf("请输入第%d个航班的起点站:\n",x+1);
scanf("%s",(*t).a[x].qidian);
printf("请输入第%d个航班的终点站:\n",x+1);
scanf("%s",(*t).a[x].zhongdian);
printf("请输入第%d个航班的起飞时间:\n",x+1);
scanf("%s",(*t).a[x].qifeishijian);
printf("请输入第%d个航班的到达时间:\n",x+1);
scanf("%s",(*t).a[x].daodashijian);
printf("请输入第%d个航班的飞机型号:\n",x+1);
scanf("%s",(*t).a[x].feijixinghao);
}
}

shuru(struct shunxu *t) {...}
struct shunxu *t 是 shuru函数的形式参数。 *t 是 结构体指针,指向 struct shunxu 类型的结构。
shunxu 结构 前面已声明过,它有两个参数,一个是结构 AIR a[Max]; 另一个是
int deft;
scanf("%d",&(*t).deft); 这里deft 是 int 型,做输入参数用时,要用 变量的地址。
scanf("%d",&(*t).a[x].No); 这里No int 型,做输入参数用时,要用 变量的地址。
scanf("%s",(*t).a[x].qidian); 这里qidian 是 char 数组,相当于字符串,做输入参数用时,要用首地址,即指针。类似的其它字符串变量输入,也用指针。
上面 &是求地址运算符。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2019-01-12
指针,你的代码呢?