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 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.