NSArray *numbers;
NSString *string;
numbers = [NSArray arrayWithObjects: @"One", @"Two", @"Three",
nil];
string = [numbers objectAtIndex: 2]; // @"Three"
Of course, you have to be careful not to ask for an object at an index
which is negative or bigger than the size of the array; if you do, an
NSRangeException is raised (we'll learn more about exceptions
in another tutorial).
To get the length of an array, you use the method -count, as in:
NSArray *numbers;
int i;
numbers = [NSArray arrayWithObjects: @"One", @"Two", @"Three",
nil];
i = [numbers count]; // 3