struct 结构指针.pptVIP

  • 3
  • 0
  • 约 16页
  • 2016-06-01 发布于湖北
  • 举报
* 结构体指针 struct student { int num; char name[20]; char sex; int age; }; struct student stu; /*定义结构体变量*/ struct student *pstu; /*定义结构体指针*/ pstu = stu; 怎样通过stu访问stu的成员? stu.num = 1; /*成员运算符*/ Stu.name=“mary”; 怎样通过pstu访问stu的成员? (*pstu).num = 1; pstu-name = “mary“; /*指向运算符*/ 第二种更常用 pstu stu num name sex age * 练习题 struct student { int num; char name[20]; char sex; struct date birthday; }; 请定义一个指针变量,指向此结构体,利用指针变量,存储1位学生的信息,并输出这位学生的信息。 * #include myfile.h struct stude

文档评论(0)

1亿VIP精品文档

相关文档