Jagged array
Appearance

In computer science a jagged array, also known as a ragged array, is a type of multidimensional array data structure whose elements consist of one-dimensional arrays, hence it is an "array of arrays". The array is called "jagged" because the elemental arrays can be of different dimensions and sizes.[1] In contrast, C-styled arrays are always rectangular.[2]
Multidimensional arrays in languages such as Java, Python (multidimensional lists), Ruby, Visual Basic.NET, Perl, PHP, JavaScript, Objective-C, Swift, and Atlas Autocode are implemented as Iliffe vectors.
Example
In C#, jagged arrays can be created with the following code:[3]
int[][]c;
c=new int[2][]; // creates 2 rows
c[]=new int[5]; // 5 columns for row 0
c[1]=new int[3]; // create 3 columns for row 1
See also
References
- ^ Jesse Liberty; Brian MacDonald (18 November 2008). Learning C# 3.0. "O'Reilly Media, Inc.". pp. 210–. ISBN 978-0-596-55420-0.
- ^ Don Box (2002). Essential .Net: The Common Language Runtime. Addison-Wesley Professional. p. 138. ISBN 978-0-201-73411-9.
- ^ Paul J. Deitel; Harvey M. Deitel (26 September 2008). C# 2008 for Programmers. Pearson Education. p. 40. ISBN 978-0-13-701188-9.