Описание тега jagged-arrays

A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an "array of arrays."

In computer science, a jagged array, also known as a ragged array, is an array of arrays of which the member arrays can be of different sizes, producing rows of jagged edges when visualized as output. In contrast, C-styled arrays are always rectangular; 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 (come from here).

In C#, jagged arrays can be created with the following code:

int[][]c;
c=new int[2][]; // creates 2 rows
c[0]=new int[5]; // 5 columns for row 0
c[1]=new int[3]; // create 3 columns for row 1

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

using namespace System;
int main()
{
    array<array<double> ^> ^ Arrayname = gcnew array <array<double> ^> (4);// array contains 4 
    //elements
    return 0;
}

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

 multi_list_3d = [[[] for i in range(3)] for i in range(3)] # [[[], [], []], [[], [], []], [[], [], []]]
 multi_list_5d = [[[] for i in range(5)] for i in range(5)] # [[[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []]]