一、”.”和”->”的区别 对于结构体指针,应该使用”->” 对于结构体,应该使用”.”‘ 举例: 1234567891011121314struct Student { int age; char name[20];};// 定义结构体变量struct Student s;s.age = 20; // 直接通过变量访问成员strcpy(s.name, "Alice");struct Student *ptr;ptr = &s; // ptr指向结构体变量sptr->age = 21; // 通过指针访问成员// 等价于 (*ptr).age = 21;