2d array are complicated for can anyone help me by simply them to me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

2d array are complicated for can anyone help me by simply them to me

Arrays

29th Sep 2018, 12:06 AM
thato
3 Answers
+ 3
A 2d array is simply an array of arrays. Every index in the array is an array. Another way that helps me when I'm using 2d arrays, is to think of it like this: "I want to access the second array ( arr[1] ). In that array, I want the 3rd element: arr [1][4]". Left-to-right is equal to outer-to-inner."
29th Sep 2018, 3:14 AM
Zeke Williams
Zeke Williams - avatar
+ 2
organise them into rows, columns in your code it will make them eaiser to understand int i[][] = {{1,2,3} {4,5,6} {7,8,9}}; 1 = [0][0] 2= [0][1] 3= [0][2] or 1 = [0][0] 4 = [1][0] 7 = [2][0]
29th Sep 2018, 6:40 AM
D_Stark
D_Stark - avatar
+ 1
take the 2d as int[4][5] here assume 4 as the 4 box in each box contains 5 box thats simple...
29th Sep 2018, 10:50 AM
Aarav Raj
Aarav Raj - avatar