例8-1-下表为学生的信息表,要求从键盘输入学生的信息,并课件-新版.pptVIP

  • 10
  • 0
  • 约9.94千字
  • 约 48页
  • 2019-12-22 发布于湖北
  • 举报

例8-1-下表为学生的信息表,要求从键盘输入学生的信息,并课件-新版.ppt

8.1 结构体类型与结构体变量 8.1.6 指向结构体变量的指针 其值是该结构体变量所分配的存储区域的首地址 结构体指针变量的定义 struct student struct student *p=stu1; { int num; char name[20]; char sex; int age; float score; ?}stu1={10001,zhang,M,19,88}; 通过指针访问结构体变量的成员 结构体变量中简单成员的引用: 结构体变量名.成员名 结构体指针-成员名 (*结构体指针).成员名 8.1 结构体类型与结构体变量 例8-3 使用指向结构体变量的指针访问输出结构体变量中各个成员的值。 #include stdio.h #include string.h void main() { struct student { int num; char name[20]; char sex; int age; float score; }stu1={10001,zhang,M,19,88}; struct student *p=stu1; printf(%d,%s,%c,%d,%6.2f\n,p-num,p-na

文档评论(0)

1亿VIP精品文档

相关文档