# NSMutableString vs NSString

**URL:** <https://forum.kirupa.com/t/nsmutablestring-vs-nsstring/270107>\
**Category:** Uncategorized\
**Created:** [September 5, 2008, 6:55am UTC](https://forum.kirupa.com/t/nsmutablestring-vs-nsstring/270107 "2008-09-05T06:55:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [September 5, 2008, 6:55am UTC](https://forum.kirupa.com/t/nsmutablestring-vs-nsstring/270107/1 "2008-09-05T06:55:29Z")

</div>

So, the documentation says:

> [@AppleDocs](#):
>
> The NSString class declares the programmatic interface for an object that manages immutable strings. (An immutable string is a text string that is defined when it is created and subsequently cannot be changed.

Why am I able to change the value of the NSString object in this code? I feel like I’m missing something.

```auto

#import <Foundation/NSString.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSAutoreleasePool.h>

int main(int argc, char *argv[])
{
	NSAutoreleasePool *pool = [NSAutoreleasePool new];
	
	NSString *myStr = @"I can haz programburger";
	
	myStr = @"banana";
	
	printf("
 %s 
", [myStr UTF8String]); //Returns "banana"
	
	[pool release];
	
	return 0;
}

```
