0

int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; myArr[0][2] = 42; can't get this declaration?

25th Sep 2018, 2:58 PM
yoga
2 Réponses
+ 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;
1st Oct 2018, 8:02 PM
John Wells
John Wells - avatar
+ 1
Thank you
2nd Oct 2018, 2:05 AM
yoga