码迷,mamicode.com
首页 > 其他好文 > 详细

结构体

时间:2016-06-30 23:11:46      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:

struct Student {
   String name;
   int age;    
};

struct Student * p; //定义了一个结构体类型的指针,指向struct Student的类型
struct Student A= {"John", 21}; //定义了一个Student类型变量并赋值
int X;
p = &A; // 将变量A的地址赋给p,此时p指向A
X = p->age;  //等价于(*p).age, *p表示p指向结构体变量

 

结构体

标签:

原文地址:http://www.cnblogs.com/myseries/p/5631343.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!