Difference between NSArray and NSMutableArray

IphoneNsmutablearrayNsarray

Iphone Problem Overview


What is the difference b/w NSArray and NSMutableArray?

Iphone Solutions


Solution 1 - Iphone

NSMutableArray (and all other classes with Mutable in the name) can be modified. So, if you create a plain NSArray, you cannot change its contents later (without recreating it). But if you create an NSMutableArray, you can change it — you'll notice it has methods like -addObject: and -insertObject:atIndex:.

See the documentation for details.

Solution 2 - Iphone

The "mutable" types are classes which can be changed after they've been initialized, like NSMutableString vs NSString.

Solution 3 - Iphone

NSArray : in NSArray we can not change index.... Means fix array.

NSMutableArray : in NSMutableArray we can change index and also add the value in array at run-time..

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questiong.revolutionView Question on Stackoverflow
Solution 1 - IphonejtbandesView Answer on Stackoverflow
Solution 2 - IphoneShaggy FrogView Answer on Stackoverflow
Solution 3 - IphoneJagat DaveView Answer on Stackoverflow