第7章结构体共用体与枚举.pptVIP

  • 4
  • 0
  • 约1.65万字
  • 约 54页
  • 2017-02-11 发布于广东
  • 举报
第7章结构体共用体与枚举

* 第7章 结构体 * 7.2 结构体变量 7.2.6 结构体与函数 【例7-9】 输出学生的全部信息。 #include stdio.h struct student {long num; char name[20]; int age; char sex; char address[30]; }; void print(struct student p) { printf(学号:%ld\t姓名:%s\t年龄:%d\t性别:%c\t通讯地址:%s\n, .num,p.name,p.age,p.sex, p.address); } * 第7章 结构体 * 7.2 结构体变量 7.2.6 结构体与函数 续【例7-9】 输出学生的全部信息。 void main() { struct student stu[3]={ {201001,李宁,18, M, 淮南大学南路252号}, {201002,清青,18, F, 淮南人民南路361号}, {201003,王新,20, M, 淮南国庆路196号} }; int i; for(i=0;i3;i++) print(stu[i]); } * 第7章 结构体 * 7.2 结构体变量 7.2.6 结构体与函数 2.结构体指针作为函数参数 此用法一般用于结构体数组问

文档评论(0)

1亿VIP精品文档

相关文档