9. Using Arrays and Dictionaries

In this chapter, we’re going to explore two important features of the Objective-C Foundation classes: arrays and dictionaries.

You saw C-style arrays in Chapter 3. Those arrays let you handle your data as a set of values accessible by index. For example, here’s how to create a standard array and display some information about it:

#include <stdio.h>int main(){  int scores[5] = {92 , 73 , 57 , 98 ,    89 };  printf(    "The array is %i elements long.",    sizeof(scores) / sizeof(int));  return 0;}

In this chapter, you’re going to build arrays using the Foundation classes that come with Objective-C. Those array classes let you do more with arrays, such as sort them, as you’ll see in this chapter.

You can also create ...

Get Objective-C: Visual QuickStart Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.