首页 > 其他 > 详细

结构体与指针

时间:2014-08-12 16:39:44      阅读:253      评论:0      收藏:0      [点我收藏+]

若我们用[0x9999]来标记内存地址,则 *[0x9999]表示该地址内存中存储的数值

变量
int a;
a *[0x9999] 1
&a [0x9999]

指针
int* a;
a *[0x8888] [0x9999]
*a *(*[0x8888]) *[0x9999] 1
&a [0x8888]

结构体变量
struct mystruct
{
int a; [0x9991]
int b; [0x9992]
int c; [0x9993]
}s;

s *[0x9991] 1
&s [0x9991]
s.a *[0x9991] 1
&s.a [0x9991]

结构体指针变量
struct mystruct
{
int a; [0x9999]
int b; [0x999A]
int c; [0x999B]
};

struct mystruct* s;
s *[0x8888] [0x9999]
*s *(*[0x8888]) *[0x9999] 1
&s [0x8888]

s->a *(*[0x8888]) *[0x9999] 1
&s->a [0x9999]
*s->a none

数组(很奇怪)
int a[];
&a [0x9999]
a [0x9999]
*a *[0x9999] 1

a[0] *[0x9999] 1
&a[0] [0x9999]


结构体数组(很奇怪)
struct mystruct
{
int a; [0x9999]
int b; [0x999A]
int c; [0x999B]
};

struct mystruct s[];
s[0].a *[0x9999] 1
s[0] *[0x9999] 1
&s[0] [0x9999]

s [0x9999]
*s *[0x9999] 1
&s [0x9999]

 

结构体与指针,布布扣,bubuko.com

结构体与指针

原文:http://www.cnblogs.com/cation/p/3907258.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!