[第十章结构体和共同体.pptVIP

  • 3
  • 0
  • 约 48页
  • 2017-01-10 发布于北京
  • 举报
[第十章结构体和共同体

§10.6 指向结构体类型数据的指针 P218 一、指向结构体变量的指针 一个指针变量当用来指向一个结构体变量时, 称之为结构体指针变量。 结构体指针变量中的值是所指向的结构变量的首地址。 通过结构指针即可访问该结构变量。 有了结构指针变量,就能更方便地访问结构变量的各个成员。 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 结构指针变量说明的一般形式为: struct 结构名 *结构指针变量名 main() { struct student { int num; char name[20]; char sex; int age; float score; char addr[30]; }; struct student stu_1; struct student *p; p=stu_1; stu_1.num=101; strcpy(stu_1.name,Li Lin); stu_1.sex=M; stu_1.score=89.5; printf(%f,%f,stu_1.score,(*p).score); ge

文档评论(0)

1亿VIP精品文档

相关文档