Q:

As another example, it is common to use a pair of nested for loops to process the elements in a multidimensional array

0

As another example, it is common to use a pair of nested for loops to process the elements in a multidimensional array.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

constexpr size_t rowCnt = 3, colCnt = 4;
int ia[rowCnt][colCnt]; // 12 uninitialized elements
// for each row
for (size_t i = 0; i != rowCnt; ++i) {
 // for each column within the row
 for (size_t j = 0; j != colCnt; ++j) {
 // assign the element's positional index as its value
 ia[i][j] = i * colCnt + j; }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now