Jagged array

In computer science, a jagged array, also known as a ragged  array or irregular array is an array of arrays of which the member arrays can be of different lengths, producing rows of jagged edges when visualized as output. In contrast, two-dimensional arrays are always rectangular so jagged arrays should not be confused with multidimensional arrays, but the former is often used to emulate the latter.

Arrays of arrays in languages such as Java, PHP, Python (multidimensional lists), Ruby, C#.NET, Visual Basic.NET, Perl, JavaScript, Objective-C, Swift, and Atlas Autocode are implemented as Iliffe vectors.

Examples
In C# and Java jagged arrays can be created with the following code:

In C and C++, a jagged array can be created (on the stack) using the following code:

In C/C++, jagged arrays can also be created (on the heap) with an array of pointers:

In C++/CLI, jagged array can be created with the code:

In Fortran, a jagged array can be created using derived types with allocatable component(s):

In Python, jagged arrays are not native but one can use list comprehensions to create a multi-dimensional list which supports any dimensional matrix: