Chapter 7
Storing Sequences in Arrays
In This Chapter
Considering the need for something like an array
Introducing the array data type
Using an array
Using the most common type of array — the character string
An array is a sequence of variables that shares the same name and that is referenced using an index. Arrays are useful little critters that allow you to store a large number of values of the same type that are related in some way — for example, the batting averages of all the players on the same team might be a good candidate for storage within an array. Arrays can be multidimensional, too, allowing you, for example, to store an array of batting averages within an array of months, which allows you to work with the batting averages of the team as they occur by month.
In this chapter, you find out how to initialize and use arrays for fun and profit. You also find out about an especially useful form of array called a char string.
Arraying the Arguments for Arrays
Consider the following problem. You need a program that can read a sequence of numbers from the keyboard and display ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access