I'm currently being bamboozled by a multidimensional array.
I know a good deal about programming and I was wondering about the logic pertaining to a question from one of quiz modules from cpp institute.
int* t[2] = { new int[2], new int[2] };
for (int i = 0; i < 4; i++)
t[i % 2][i / 2] = i;
std::cout << t[0][1] + t[1][0] << endl;
delete[] t[0];
delete[] t[1];
When the compiler gets to:
for (int i = 0; i < 4; i++)
t[i % 2][i / 2] = i;
I get a little lost, is t[int][int] manipulated every 'i' loop? I know what the answer is so I'm just looking for logic clarification to understand how multidimensional arrays are calculated in loops.