Jagged Arrays

A jagged array is an array whose elements are arrays, possibly of different sizes.
A jagged array is sometimes called an "array of arrays."


link - learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/jagged-arrays 

A variation of the multidimensional array is the jagged array: an array of arrays.
A jagged array is a single-dimensional array, and each element is itself an array.
The element arrays are not required to all be of the same size.


You declare a jagged array like this:


int[][] jaggedArray = new int[3][]; 

jaggedArray[0] = new int[5];
jaggedArray[1] = new int[4];
jaggedArray[2] = new int[2];





© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext