Please send questions to
st10@humboldt.edu .
* 2-d arrays in C++
* ..really, just an array of arrays!
const int NUM_ROWS = 4;
const int NUM_COLS = 3;
char initials[NUM_ROWS][NUM_COLS];
(or in general: type name[SIZE_of_1st_dim][SIZE_of_2nd_dim]; )
* then initials[0][0] is the leftmost top element in the
array
initials[0][1] is the element in the middle of the
first row of the array,
...
initials[3][2] is the element on the rightmost bottom
of the array
* nested loops --- loops inside loops!
...and a nested loop would be dandy for operating
on everything in a 2-d array;
a for loop in a for loop would be great for filling in initials!
see: fill_2_d.cpp
* an example that USES many of these array functions
we've developed in a single program: update.cpp
(which uses get_file_contents,
show_indexed_contents,
request_changes,
sum_contents2, and
put_contents)