You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
668 B
C#

/*
* C# Program to Demonstrate Jagged Arrays
*/
using System;
class Program
{
static void Main()
{
int[][] jag = new int[3][];
jag[0] = new int[2];
jag[0][0] = 11;
jag[0][1] = 12;
jag[1] = new int[1] {11};
jag[2] = new int[3] { 14,15, 16 };
for (int i = 0; i < jag.Length; i++)
{
int[] innerArray = jag[i];
for (int a = 0; a < innerArray.Length; a++)
{
Console.WriteLine(innerArray[a] + " ");
}
}
Console.Read();
}
}
/*
11
12
11
14
15
16