Im triyng to learn to code with Xcode
I got a book Beginning Objective C Programming - Tutorials for the Beginner
(http://www.amazon.com/gp/product/B006OGB8ZK/ref=kinw_myk_ro_title) and it has me starting out with doing a simple addition program. Mac os console
it returns the error that NSAutoreleasePool is unavailable.
I know what the program is attempting to do. its trying to output the result of 7 and that The program has terminated successfully in the console window.
any ideal why its resulting in this error and how I can fix it.
I got a book Beginning Objective C Programming - Tutorials for the Beginner
(http://www.amazon.com/gp/product/B006OGB8ZK/ref=kinw_myk_ro_title) and it has me starting out with doing a simple addition program. Mac os console
Code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init ];
// insert code here...
//declare and intialize variables
int firstNumber=2;
int secondNumber=3;
int totalSum=0;
firstNumber=firstNumber+1;
secondNumber=secondNumber+1;
totalSum=firstNumber+secondNumber;
NSLog(@"%d",totalSum);
NSLog(@"The program has terminated successfully.");
[pool drain];
return 0;
}
I know what the program is attempting to do. its trying to output the result of 7 and that The program has terminated successfully in the console window.
any ideal why its resulting in this error and how I can fix it.
Last edited by a moderator: