Chapter 11: Working with Arrays
We have already seen how a structure is a grouping of one or more components that can each be of different data types. Often, we need a grouping that consists of the same type; this is called an array. An array is a collection of multiple occurrences of the same data type grouped together under a single name. Each element of the array is accessed via its base name and an offset of that base. Arrays have many uses, from organizing homogenous data types to providing the basis for strings, or arrays of characters.
Before we can learn about some of the wide uses of arrays, we need to explore the basics of declaring and manipulating arrays.
The following topics will be covered in this chapter:
- Declaring an array of values
- Initializing an array in several ways
- Understanding variable-length arrays
- Accessing each element of an array
- Understanding zero-based array indexing
- Assigning and manipulating elements of an array ...