帮忙解释一下结构体的成员输入问题。。
程序代码:#include<stdio.h>
struct Student
{
char num[10];
char name[20];
int score[3];
};
void print(struct Student *p)
{
int i;
printf("No. 姓名 科目1 科目2 科目3\n");
for(i=0;i<5;i++)
{
printf("%s %s %d %d %d",p->num,p->name,p->score[0],p->score[1],(p++)->score[2]);
printf("\n");
}
}
void main()
{
struct Student student[5];
struct Student *p;
int i;
printf("请输入5个学生的学号,姓名,3个科目的分数:\n");
printf("No. 姓名 科目1 科目2 科目3\n");
for(i=0;i<5;i++)
scanf("%s %s %d %d %d",student[i].num,student[i].name,&student[i].score[0],&student[i].score[1],&student[i].score[2]);//三个学生成绩的输入为什么要加地址符?
p=student;
print(p);
}为什么这个要加地址符?&student[i].score[0],&student[i].score[1],&student[i].score[2],那个结构体成员不是数组类型的吗?







