Introduction to Arrays in C++
- So far we have only been using simple data types: char, int, long, float; these data types cannot be broken down into component parts
- A structured data type is a collection of data items that all share the same name, yet each can still be accessed individually
- All structured types are constructed from the simple, built-in data types
- An array is the simplest structured data type; it is simple because all elements of the array are of the same type
- Arrays allow the programmer to easily declare hundreds, or thousands, of variables in a single declaration
- Each component of the array is called an element; each element is the same size and has the same type
- Arrays are the most common structured data type; almost all programs use them in some way or another
- Individual elements are accessed using an index into the array; an index is an integral value; an element's index is its position within the array
- Arrays are zero-based, meaning that the first element is at index 0, the second is at index 1, etc.
Next page
Back to Lesson 11 Index
Back to Outline