
Arrays of Classes 525
1 2 3
2 3 4
3 4 5
2 3 4
3 4 5
4 5 6
Explanation: The three-dimensional array
array_3d is initialized. The first three for loops
are used for adding the values of a, b & c. Here, initially, a & b are zero, and ‘c’ varies
from 0 to 2. Hence, the addition of a, b & c will be 0 1 2. This will be printed in the first row.
The second output row is one in which a = 0, b = 1, and c varies from 0 to 2. Thus, the
output of the second row will be 1 2 3. In this way, the values of a, b & c are changed, and a
total of 27 iterations are carried out.
12.12 ARRAYS OF CLASSES
As we know, an array is a collection of similar data types. In the ...