how can i print the values of this jagged array.
here jagged array size is 3.just bcoz each position of jagged array points to different size 2D array. i m not able to print its values. when i run this program only 1 and 3 displayed and its shows following error
" system.index.outofrange exception"
What I have tried:
static void Main(string[] args)
{
int[][,] jaggedArray4 = new int[3][,]
{
new int[,] { {1,3}, {5,7} },
new int[,] { {0,2}, {4,6}, {8,10} },
new int[,] { {11,22}, {99,88}, {0,9} }
};
Console.WriteLine("Your Data\n");
for (int i = 0; i < jaggedArray4.Length; i++)
{
for (int j = 0; j < jaggedArray4[i].Length; j++)
{
for (int k = 0; k < jaggedArray4[j].Length;k++)
{
Console.WriteLine("jaggedposition i[{0}] 2D array[{1},{2}] is {3}", i, j, k, jaggedArray4[i][j,k]);
}
Console.WriteLine("\n");
}
Console.WriteLine("\n");
}