11 12 11 14 15 16
This is a C# Program to demonstrate jagged arrays.
This C# Program Demonstrates Jagged Arrays.
Here Jagged Arrays can store efficiently many rows of varying lengths. Any type of data, reference or value, can be used.
Here is source code of the C# Program to Demonstrate Jagged Arrays. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * 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(); } }
This C# Program is used to Demonstrate Jagged Arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an “array of arrays.” Create a new array in the jagged array, and assign its coefficient values, and form second row and third row by using array initialize.
11 12 11 14 15 16