How 42 ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How 42 ?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int[ ][ ] jaggedArr = new int[ ][ ] { new int[ ] {1,8,2,7,9}, new int[ ] {2,4,6}, new int[ ] {33,42} }; int x = jaggedArr[2][1]; Console.WriteLine(x); } } }

3rd Feb 2020, 7:32 PM
Ehsan Wattoo
4 Answers
+ 6
Because of [2][1] Here row wise index is 2 and column wise index is 1. So will check in third array where on 1st index value is 42
3rd Feb 2020, 7:42 PM
A͢J
A͢J - avatar
+ 2
Imagine an array which contains 3 other arrays. The outer array has indices. And all inner arrays has indeces. jaggedArr[0][x] means the first inner array -> 1,8,2,7,9 jaggedArr[0][0] = 1 jaggedArr[0][1] = 8 jaggedArr[0][2] = 2 jaggedArr[0][3] = 7 jaggedArr[0][4] = 9 jaggedArr[2][x] means this array: 33,42 inside this array the value of index 1 is 42 -> jaggedArr[2][1] = 42
3rd Feb 2020, 8:01 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Denise Roßberg thankssss bro
3rd Feb 2020, 8:06 PM
Ehsan Wattoo
+ 2
Ehsan Wattoo Your welcome :)
3rd Feb 2020, 8:06 PM
Denise Roßberg
Denise Roßberg - avatar