+ 2
Two dimensional array display using two for loops.
Need a detailed explanation of the 2d array using for loop https://code.sololearn.com/c3hIr05cP1uB/?ref=app
8 Answers
+ 3
This is very nice expample by voja maybe it helps! All the best
https://code.sololearn.com/cg90pX9yh7dh/?ref=app
+ 5
A multidimensional array is an array, which contains arrays.
In your case you have two arrays inside an array.
Each array has an index (0 & 1) and each value has an index (3 values: index from 0 -2)
sample[][] -> in the first bracket is the index of the array, second bracket: index of the value in this array.
e.g. sample[0][1] //2
sample[1][2] //6
That's why you need a nested for loop.
The outer loop (0 - 1) goes through the arrays, the inner loop goes through the values of this array.
i = 0 -> j = 0, j = 1, j = 2
i = 1 -> j = 0, j = 1, j = 2
print sample[i][j] -> sample[0][0], sample[0][1], sample[0][2] ... sample[1][2]
+ 3
shruti kencha Your welcome :)
+ 3
thank you for detail explanation
+ 2
Vasiliy thanks for the explanation in detail.. through the code .. able to understand the concept easily
+ 2
Atila Sabo thank you or the detailed description of the 2d array... Appreciate your help
+ 1
Pay attention to the variables i and j, I hope this will help in understanding.
https://code.sololearn.com/c55OLS5Kz8rg/?ref=app
+ 1
Denise RoĂberg thanku so much for your help.. I totally understood the concept