+ 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

21st May 2019, 9:42 PM
shruti kencha
8 Antworten
+ 3
This is very nice expample by voja maybe it helps! All the best https://code.sololearn.com/cg90pX9yh7dh/?ref=app
22nd May 2019, 4:17 AM
Atila Sabo
Atila Sabo - avatar
+ 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]
21st May 2019, 10:44 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
shruti kencha Your welcome :)
22nd May 2019, 12:46 AM
Denise Roßberg
Denise Roßberg - avatar
+ 3
thank you for detail explanation
26th May 2019, 5:05 AM
notesforgeeks.com
notesforgeeks.com - avatar
+ 2
Vasiliy thanks for the explanation in detail.. through the code .. able to understand the concept easily
22nd May 2019, 12:45 AM
shruti kencha
+ 2
Atila Sabo thank you or the detailed description of the 2d array... Appreciate your help
23rd May 2019, 5:37 PM
shruti kencha
+ 1
Pay attention to the variables i and j, I hope this will help in understanding. https://code.sololearn.com/c55OLS5Kz8rg/?ref=app
21st May 2019, 10:31 PM
Solo
Solo - avatar
+ 1
Denise Roßberg thanku so much for your help.. I totally understood the concept
22nd May 2019, 12:44 AM
shruti kencha