OC地址偏移-赋值

2019-03-12  本文已影响0人  朱云哲

NSInteger a = 1;

    NSIntegerb =2;

   NSInteger*c =  (&a -1);

    *c =3;

    NSLog(@"&a %p",&a);

    NSLog(@"&b %p",&b);

    NSLog(@"&c %p",&c);

    NSLog(@"&d %p",(&a -1));

    NSLog(@"a %zd",a);

    NSLog(@"b %zd",b);


2019-03-12 23:30:59.627980+0800 Test-day1[64413:612081] &a 0x7ffee82859b8

2019-03-12 23:30:59.628217+0800 Test-day1[64413:612081] &b 0x7ffee82859b0

2019-03-12 23:30:59.628365+0800 Test-day1[64413:612081] &c 0x7ffee82859a8

2019-03-12 23:30:59.628495+0800 Test-day1[64413:612081] &d 0x7ffee82859b0

2019-03-12 23:30:59.628691+0800 Test-day1[64413:612081] a 1

2019-03-12 23:30:59.628807+0800 Test-day1[64413:612081] b 3


上一篇下一篇

猜你喜欢

热点阅读