# Thread: I am having a hard time understanding this...

1. ## I am having a hard time understanding this...

So here's the code:

Code:
```#include <iostream>
using namespace std;
int main() {
int t,i, nums[3][4];
for(t = 0; t < 3; ++t){
for(i=0;i < 4; ++i) {
nums[t][i] = (t*4)+i+1;
cout << nums[t][i] << ' ';
}
cout  << "\n";
}
return 0;
}```
And I just don't understand what this will do! My book says it will put the numbers 1 through eleven into each box, but I do not see how this is possible (I did compile this, I just don't understand how the answer was created).

So, when the first for loop runs, t = 0, so it increments once, then it runs the second for loop, and the I = 0, so it increments until it does not equal a number less than four (which will be four). Then the mathematical thing, that assigns the numbers to the arrays, puts the number nums[t][i], which would be: nums[1][4]. The number that is put there, is (4 * t) + i + 1. So the number put in nums[1][4] is 6. But when I run it I get this:

1 2 3 4
5 6 7 8
9 10 11 12

I know I am misunderstanding something. Which dimension comes first, when assigning things to an array? does: nums[1][4], the one refers to 1 down, or one across?