Chapter 7 Arrays Flashcards
7.1 Arrays can hold ____ _____.
Multiple values
7.1 How are the values in arrays stored?
The values are stored together in consecutive memory locations.
7.1 int days[6];
This is a definition of an array of integers.
7.1 How many elements can this array store?
int days[6];
6
7.1 An array’s size declarator must be?
A constant integer expression with a value greater than 0.
7.1 Arrays can either be a literal (EX: int days[6];), or?
Named constants.
EX: const int NUM_DAYS = 6;
int days [NUM_DAYS];
7.1 The amount of memory used by an array depends on?
Depends on the array’s data type and the number of elements.
7.1 The size of an array can be calculated by?
By multiplying the size of an individual element by the number of elements in the array.
7.2 What is a subscript?
A number that is assigned to each element in an array.
7.2 What is the use of a subscript?
A subscript is used as an index to pinpoint a specific element within an array.
7.2 Subscript numbering starts at what number?
Subscript numbering in C++ always starts at 0.
7.2 May array elements be used with the cin and cout objects like any other variable?
Yes
7.2 Storing subscript numbers in variable makes it possible to do what?
Makes it possible to use a loop to “cycle through” an entire array, performing the same operation on each element.
7.3 Does C++ perform array bounds checking?
In order to increase runtime efficiency, C++ does not perform array bounds checking.
7.3 In working with arrays, what is a common type of mistake?
Off-by-one error.