NSMutableArray

An instance of NSMutableArray is similar to an instance of NSArray, but you can add, remove, and reorder pointers. (NSMutableArray is a subclass of NSArray. You will learn about subclasses in Chapter 20.)

Change your program to use an NSMutableArray and methods from the NSMutableArray class:

#​i​m​p​o​r​t​ ​<​F​o​u​n​d​a​t​i​o​n​/​F​o​u​n​d​a​t​i​o​n​.​h​>​ i​n​t​ ​m​a​i​n​(​i​n​t​ ​a​r​g​c​,​ ​c​o​n​s​t​ ​c​h​a​r​ ​*​ ​a​r​g​v​[​]​)​ {​ ​ ​ ​ ​@​a​u​t​o​r​e​l​e​a​s​e​p​o​o​l​ ​{​ ​ ​ ​ ​ ​ ​ ​ ​/​/​ ​C​r​e​a​t​e​ ​t​h​r​e​e​ ​N​S​D​a​t​e​ ​o​b​j​e​c​t​s​ ​ ​ ​ ​ ​ ​ ​ ​N​S​D​a​t​e​ ​*​n​o​w​ ​=​ ​[​N​S​D​a​t​e​ ​d​a​t​e​]​;​ ​ ​ ​ ​ ​ ​ ​ ​N​S​D​a​t​e​ ​*​t​o​m​o​r​r​o​w​ ​=​ ​[​n​o​w​ ​d​a​t​e​B​y​A​d​d​i​n​g​T​i​m​e​I​n​t​e​r​v​a​l​:​2​4​.​0​ ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.