struct class 内存结构初探-内存模型顺序和变量的实际添加顺序一致

typedef struct structTest {

char xchar;

int xint;

int yint;

}xStruct;

@interface ViewController ()

{

char xchar;

int xint;

int yint;

}

xStruct xTest = {'a', 1, 2};

NSLog(@"%p,%p, %p",&xTest.xchar, &xTest.xint, &xTest.yint);

NSLog(@"%p,%p, %p", &xchar, &xint, &yint);

2017-02-22 14:39:01.957 structTest[53135:4290831] 0x7fff5f694a60,0x7fff5f694a64, 0x7fff5f694a68

2017-02-22 14:39:01.958 structTest[53135:4290831] 0x7fe5825115c0,0x7fe5825115c4, 0x7fe5825115c8

上一篇:探索未知种族之osg类生物---器官初始化一


下一篇:Java内存模型、JVM内存结构和Java对象模型