a.name, a.age, a.sex, a.depart, wage);
while(1)
{
printf("Continue?");
c=getche();
if(c=='Y'||c=='y'||c=='N'||c=='n')
break;
}
}
fclose(fp);
}
3. 结构数组和结构指针
结构是一种新的数据类型, 同样可以有结构数组和结构指针。
一、结构数组
结构数组就是具有相同结构类型的变量集合。假如要定义一个班级40个同学
的姓名、性别、年龄和住址, 可以定义成一个结构数组。如下所示:
struct{
char name[8];
char sex[2];
int age;