【发布时间】:2014-01-07 12:56:05
【问题描述】:
NSDate *now = [NSDate date];
NSLog(@"This NSDate object lives at %p", now);
NSLog(@"The date is %@", now);
好的,从这段代码中,我知道now 是指向NSDate 对象的指针,但是在第3 行的代码中,如何取消引用没有星号的指针?我们为什么不在第 3 行做这样的代码:
NSLog(@"The date is %@", *now);
【问题讨论】:
-
等到你得到指向指针的地址,比如使用 NSError。我的一般建议是阅读 K&R(Kernigan 和 Richie)的 C 指南,以深入了解指针,尽管是枯燥的。
标签: ios objective-c pointers dereference