int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; myArr[0][2] = 42; int x = myArr[1][0]; // 4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; myArr[0][2] = 42; int x = myArr[1][0]; // 4

Explain how 42 came

9th Jan 2019, 3:18 PM
Nikhil Verma
Nikhil Verma - avatar
1 Answer
0
That code will not to compile... I Made some corrections: int myArr[ ][3] = { {1, 2, 3}, {4}, {5, 6, 7} }; myArr[0][2] = 42; int x = myArr[1][0]; // 4 You need to especific the limits of all the dimensions except the first dimension
10th Jan 2019, 4:01 AM
DonLarry
DonLarry - avatar