Tuesday, October 27, 2020 08:35

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.

Comments

comments

Tags: ,

Leave a Reply



Do NOT follow this link or you will be banned from the site!