0
int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; myArr[0][2] = 42; can't get this declaration?
2 Antworten
+ 1
I'm guessing you are asking about the syntax.
int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} };
is the same as:
int myArr[3][3];
myArr[0] = {1, 2, 3};
myArr[1] = {4};
myArr[2] = {5, 6, 7};
is the same as:
int myArr[3][3];
myArr[0][0] = 1;
myArr[0][1] = 2;
myArr[0][2] = 3;
...
myArr[2][2] = 7;
+ 1
Thank you