The Objective-C language provides another tool besides arrays for grouping elements. You also can use structures, which form the basis for the discussions in this section.
Suppose you wanted to store a date—say, 7/18/14—inside a program, perhaps to be used for the heading of some program output or even for computational purposes. A natural method for storing the date is to simply assign the month to an integer variable called
month, the day to an integer variable
day, and the year to an integer variable
year. So, the statements
int month = 7, day = 18, year = 2014;
would work just fine. This is a totally acceptable approach. But what if your program also needed to store several dates? It would be much ...