+ 1

Multidimensional array coding question

int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; myArr[0][2] = 42; int x = myArr[1][0]; // 4 What is the meaning of myArr[0][2] = 42? Still cannot understand after reading comment under that topic Thanks

15th Feb 2017, 12:18 PM
freedom
2 odpowiedzi
+ 3
myArr[0][2] = 42 i.e assagin 42 to the third position of first array
15th Feb 2017, 12:37 PM
Hassan Mohd Elterifi
Hassan Mohd Elterifi - avatar
+ 1
myArr[0][2] = 42 rewrites item on third position of first array. So basicaly it makes 42 from 3.. simple rewrite
15th Feb 2017, 12:22 PM
Roman Santa
Roman Santa - avatar