Next: 2.4 arrayWithObjects Up: 2 NSArray Previous: 2.2 Comparison with Pure

2.3 NSArrays are immutable

As in the case of strings, NSArrays are immutable; you can't change them after creation (this allows the GNUstep NSArray code to use some optimisations which would be impossible otherwise). If you need an array that you can modify, you can use a subclass of NSArray, called NSMutableArray. This happens quite often, so we'll discuss it in some details later on.