   Objective C @ for strings
  Hello,I have been developing with C and C++ for some time, and have recently started learning objective C.Can someone explain the role of the @ operator when dealing with strings:string=@"some text";   
  Here's a pretty good description here in the first answer.   ;  I understand the optimization possible through using @, but... is there any case in which I would not use the @ operator?Something like:string="hello";?;Quote:string="hello";In Objective-C, an @-string is a immutable NSString instance. A string without the @ is a regular, C style string. They're not directly assignable, so your example won't even work. You'd need to initialize 'string' something like this:NSString* string = [NSString initWithCString:"hello" ...];  jpetrie explanation is totally correct, but just so you don't get caught up with the line of code he provided..NSString* string = [[NSString alloc] initWithCString: "hello" encoding: NSASCIIStringEncoding];Though, more than likely, you'll want to be working with UTF8 encoding, for which Apple has created a specific method for (though you can use the above and change the encoding parameter):NSString* string = [[NSString alloc] initWithUTF8String: "hello"];;  Different types@"hello" //this is an immutable NSString"hello" //this is a const char *-me   ;  I guess you haven't seen a EXC_BAD_ACCESS crash yet?You'll see one of those during runtime if you pass a C style string to something that expects a NSString.;  I understand the explanation, but I still see a small difference:I can not release: string=@"some text";but I do need to release:NSString* string = [NSString initWithCString:"hello" ...]How does '@' effect memory allocation?   