0
How to iterate through jagged array?
int[][,] arr=new int[3][,]; arr[0]=new int[2,3]{{1,1,1},{2,2,2}}; arr[1]=new int[1,2]{{3,3}}; arr[2]=new int[3,3]{{4,4,4},{5,5,5},{6,6,6}}; design algorithm please
4 odpowiedzi
+ 3
Got it! Missed the comma:
foreach(int[,] intArr in arr)
{
foreach(int num in intArr)
{
Console.WriteLine(num);
}
}
This should work. Full code here:
https://code.sololearn.com/cR23s2yLi42r
+ 2
Something like:
foreach(int[] intArr in arr)
{
foreach(int num in intArr)
{
Console.WriteLine(num);
}
}
I don't know. This makes my head hurt. I try to stay away from jagged arrays if possible, they quickly become complex.
+ 1
it's not working... i spent almost 2hours on it but results comes in the form of lots of errors :-(
0
@Bagshot thank you so much :-)