chapter10 指针与链表(C语言程序设计教程).ppt

第10章 指针与链表 结构体与指针 指向结构体变量的指针 结构体指针变量的定义: struct 结构体名 * 指针变量名; 例如: struct student *pt=stu; struct student { int num; char name[20]; char sex; int age; }stu; 使用结构体指针变量引用成员形式 (*结构体指针名).成员名 结构体指针名-成员名 结构体变量名.成员名 struct student { int num; char name[20]; char sex; int age; }stu; struct student *p=stu; (*p).num p-num stu.num age sex name num stu p p=stu.num 例:结构体指针的使用 #include stdio.h #include string.h struct student { int num; char name[20]; char sex; int age; }; main() { struct student stu, *p; p=stu; stu.num=10011; str

文档评论(0)

1亿VIP精品文档

相关文档