My book isn't real specific on some of these details, so I need some help.
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDateComponents *comps = [[NSDateComponents alloc ]init];
[comps setYear:1984];
[comps setMonth:7];
[comps setDay:18];
[comps setHour:0];
[comps setMinute:0];
[comps setSecond:0];
NSCalendar *g =[[NSCalendar alloc ]init];
NSDate *dateofbirth = [g dateFromComponents:comps];
NSDate *now = [NSDate date];
double timeSince = [now timeIntervalSinceDate:dateofbirth ];
NSLog(@"your age %@", timeSince);
[pool drain];
return 0;
}
I think I am running into trouble because I am initializing and allocating memory within the pool. Is this correct?

New Topic/Question
Reply


MultiQuote





|