 |
Department of Engineering |
 |
 |
Next: Character arrays
Up: C++ Summary
Previous: Enumerated types
Arrays are used to construct variables with multiple components of identical
type. Components are accessed via one or more array index expressions
within brackets []. Some examples of the definition and use of
arrays are:
float vector[100]; // elements vector[0] .. vector[99]
float matrix[100][100]; // 2-D array
for (int i = 0; i < 100; i++) // zero array vector
vector[i] = 0.0;
matrix[2][4] = vector[3]; // 2-D and 1-D accesses