That's as close as I can get without giving you the answer on a plate.
Everybody doesn't think in code, and that example is pretty vague.
Will you please give me little detail hint?
When you loop over a 2D array, you use two loops, right? One loop on the outside goes over the rows and another on the inside that goes over the columns. You do it like this.
for ( int row = 0; row < nRows; ++row ) {
for ( int col = 0; col < nCols; ++col ) {
// do something with array[row][col]
}
}
When you do that it goes over the array like this with the numbers showing the order that you visit each cell.
[01][02][03][04][05]
[06][07][08][09][10]
[11][12][13][14][15]
That's because the outer loop handles the rows and the inner loop handles the columns. But if you reverse the loops so that the outer loop handles the columns and the inner loop handles the rows, it goes over the array like this.
[01][04][07][10][13]
[02][05][08][11][14]
[03][06][09][12][15]
You do that with code like this.
for ( int col = 0; col < nCols; ++col ) {
for ( int row = 0; row < nRows; ++row ) {
// do something with array[row][col]
}
}
What that loop does is pretend the columns are rows and kind of flips the array over and rotates it by by 90 degrees clockwise. But you do it without really flipping and rotating, you just pretend that it's that way by changing the order that you work with the cells.
[01][02][03]
[04][05][06]
[07][08][09]
[10][11][12]
[13][14][15]