C# Jagged Arrays


Array Types in c#
1.      Single-dimensional arrays
2.      Multidimensional arrays or rectangular arrays
3.      Jagged arrays
4.      Mixed arrays.

Single Dimension Arrays

int[] intArray;
intArray = new int[3];

Multi-Dimensional Arrays
Array with more than one dimension is called multi- Dimensional. The form of a multi-dimensional array is a matrix.
Example :-
int[,] numbers = new int[3, 2] { { 1, 2 }, { 3, 4 }, { 5, 6 } };

Jagged Arrays
Jagged arrays are arrays of arrays.
int[][] intJaggedArray = new int[3][];
intJaggedArray[0] = new int[2]; 
intJaggedArray[1] = new int[4]; 
intJaggedArray[2] = new int[6]; 


Mixed Arrays
Mixed arrays are a combination of multi-dimension arrays and jagged arrays.