Difference between NSArray and NSMutableArray

What is the difference b / w NSArray and NSMutableArray ?

+56
iphone nsmutablearray nsarray
Aug 28 '09 at 5:46
source share
3 answers

NSMutableArray (and all other classes with Mutable in the name) can be changed. So, if you create a simple NSArray , you cannot change its contents later (without re-creating it). But if you create an NSMutableArray , you can change it - you will notice that it has methods like -addObject: and -insertObject:atIndex:

See the documentation for more details.

+111
Aug 28 '09 at 5:51
source share
— -

Volatile types are classes that can be changed after they are initialized, for example, NSMutableString vs NSString .

+4
Aug 28 '09 at 5:52
source share

NSArray: in NSArray we cannot change the index .... The tool fixes the array.

NSMutableArray: in NSMutableArray we can change the index as well as add a value to the array at runtime.

0
Feb 10 '14 at 8:00
source share



All Articles