February 2014
Beginner
1248 pages
62h 25m
English
Figure 7.17 demonstrates initializing two-dimensional arrays with array initializers, and using nested for loops to traverse the arrays (i.e., manipulate every element of each array). Class InitArray’s main declares two arrays. The declaration of array1 (line 9) uses nested array initializers of the same length to initialize the first row to the values 1, 2 and 3, and the second row to the values 4, 5 and 6. The declaration of array2 (line 10) uses nested initializers of different lengths. In this case, the first row is initialized to two elements with the values 1 and 2, respectively. The second row is initialized to one element with the value 3. The third row is initialized to three ...
Read now
Unlock full access