#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"Hello, World!");
//左侧变量now,*说明它是一个指针,这个指针保存了NSAate实例在内存中的地址;
//右侧代码返回了NSDate实例的地址。
//这段代码成为:消息发送(message send)
NSDate *now = [NSDate date];
//使用NSLog打印NSDate实例的地址;
NSLog(@"This NSDate object lives at %p", now);
}
return 0;
}
================================================================
结果:
2019-04-12 14:39:29.292665+0800 TimeAfterTime[1288:83428] Hello, World!
2019-04-12 14:39:29.292885+0800 TimeAfterTime[1288:83428] This NSDate object lives at 0x10188b6c0
Program ended with exit code: 0