Hallo, I am trying to understand how multidimensional arrays work but can't seem to figure it out. I would like help in understanding them. Yeah googled already but what I have seen so far seem to say "a multidimensional is an array of an array" which doesn't help much in understanding. I have a code here and its output. I would like someone to explain it to me the outcome well. Thanks in advance.

Output: 789456789123Code:`#include <iostream>`

using namespace std;

intmain()

{

intar[]={123,456,789};

intind[]={2,1,2,0};

intk;

for (k=0;k<4;k=k+1) {

cout<< ar[ind[k]];

}

return 0;

}

OK I think I figure it out.

OK the loop produces the values 0, 1, 2 and 3. Putting this in the array the statement becomes:

cout<< ar[ind[0]]; and so on till array 3.

From here then it is easier. Because ind[0] = 2, so it becomes array[2]. Although I understand this but intar[] has only 3 values while ind has 4, so when intar runs out of values to loop over, what is supposed to happen? Does it go back to zero and start it all over again or?