I have two quick (hopefully) questions related to variables/pointers and memory management in Objective-C.
Take the following example:
for(i=0; i<10; i++){
NSString *greeting = @"Hello @%", [someArrayOfNames objectAtIndex:i];
// do something with greeting
}
Does this code create 10 separate NSString objects? And if so, is it the case that each time through the loop, the variable "greeting" points to the one just created, and older ones aren't (easily) accessible anymore?
Thanks for any help! I'm still trying to get pointers and memory management down.
Greg
Take the following example:
for(i=0; i<10; i++){
NSString *greeting = @"Hello @%", [someArrayOfNames objectAtIndex:i];
// do something with greeting
}
Does this code create 10 separate NSString objects? And if so, is it the case that each time through the loop, the variable "greeting" points to the one just created, and older ones aren't (easily) accessible anymore?
Thanks for any help! I'm still trying to get pointers and memory management down.
Greg