In code
Does myStr get assigned a POINTER to temporarily created string object, which gets created when we use the @ in front of the delimited text?
i.e., because myStr would hold a pointer to a string object, I am wondering what the @ operator does to create that object? I would like to understand what is going on in the background with this assignment, since in other cases:
But in the string case, it's not *myStr = @"String"
?
Code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *myStr = @"ABCDEFG";
NSLog(@"Length: %i", [myStr length]);
NSLog(@"Pointer: %p\n\n", myStr);
myStr = @"Hi";
NSLog(@"Length: %i", [myStr length]);
NSLog(@"Pointer: %p", myStr);
[pool drain];
return 0;
}
Does myStr get assigned a POINTER to temporarily created string object, which gets created when we use the @ in front of the delimited text?
i.e., because myStr would hold a pointer to a string object, I am wondering what the @ operator does to create that object? I would like to understand what is going on in the background with this assignment, since in other cases:
Code:
int x = 50;
int *xPtr;
xPtr = &x;
NSLog(@"*xPrt: %i", *xPtr);
?