#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
// NSLog(@"Hello, World!");
NSDate *currentTime = nil;
NSLog(@"Current Time is %p", currentTime);
NSDate *newDate = [NSDate date];
NSLog(@"The new date is %p \n", newDate);
//复制到新的对象
NSDate *startDate = newDate;
NSLog(@"The start date is %p \n", startDate);
sleep(5);
//重置成新的对象
newDate = [NSDate date];
NSLog(@"The latest date is now changed to %p \n", newDate);
//销毁对象
newDate = nil;
NSLog(@"Now, the new date had been updated to %p \n", newDate);
}
return 0;
}
2018-03-10 21:56:58.704032+0800 TOCObjectivea[52371:13638298] Current Time is 0x0
2018-03-10 21:56:58.704302+0800 TOCObjectivea[52371:13638298] The new date is 0x1007119a0
2018-03-10 21:56:58.704330+0800 TOCObjectivea[52371:13638298] The start date is 0x1007119a0
2018-03-10 21:57:03.707665+0800 TOCObjectivea[52371:13638298] The latest date is now changed to 0x10070ca10
2018-03-10 21:57:03.708026+0800 TOCObjectivea[52371:13638298] Now, the new date had been updated to 0x0
Program ended with exit code: 0