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

posted @ 2017-02-22 14:40  zzfx  阅读(232)  评论(0编辑  收藏  举报