#include <stdio.h>
void main(){
struct stu {
char name;
int age ;
};
struct stu s ;
struct stu *ptr = &s ;
s.name = "zhangsan";
s.age = 25;
printf("姓名:%c,年龄:%d\n",s.name,s.age);
printf("姓名:%c,年龄:%d\n",ptr->name,ptr->age);
}
小结:
->运算符用在指针上,获取成员变量的值。
原文:http://www.cnblogs.com/chenweichu/p/6475614.html