C语言程序设计教程(电子教(学)案).ppt

9.3 结构体与函数 结构体变量、结构体成员和结构体类型的指针变量都能够作 为形参或实参参与函数调用。在函数调用过程中,遵循和基本 数据类型变量相同的规则。 【例9-7】通过函数调用实现例9-5的功能。 struct score { int score1; int score2; int score3; }; struct student { char name[10]; char sex; int age; struct score stscore; }; int total(struct student stud); (转后) 形参为student类型的 结构体变量stud main() { int i; struct student s[2]; for(i=0;i2;i++) { printf(Please Input name and scores\n); scanf(%s,s[i].name); scanf(%d,s[i].stscore.score1); scanf(%d,s[i].stscore.score

文档评论(0)

1亿VIP精品文档

相关文档