Saturday, April 20, 2024 13:38

Table of contents >> Arrays > Arrays of arrays

Arrays of arrays

C# allows us to have arrays of arrays, which we call jagged arrays. An array of arrays is basically an array in which each row is actually another array on its own.

This is an example of declaration for an array of arrays:

and this is how we initialize it:

Also, the arrays of the array can be one dimensional or multi-dimensional arrays, like we learned:

Finally, getting or setting the elements of an array of an array (lol, that sounds so complicated 😐 ):

Most of the times, arrays of arrays won’t be of a real use to you, there are simpler ways of doing this. However, it is good to have a vague idea in a corner of your mind about them, just in case you ever encounter a situation that would really require this concept.

The concepts explained in this lesson are also shown visually as part of the following video:

Tags: ,

Leave a Reply



Follow the white rabbit