jagged array | Jagged array in C# with example

jagged array

Jagged array is an array of arrays.

If we want to hold different column values in different rows then we should prefer jagged array.

jagged array also   store  the data in the form of row  and column like, two dimensional array, but two dimensional array. all the row will be  having equal number of column where as jagged  array the column size different form row  to row.

Jagged array also known as array  of array   because  here  different single dimensional  array  between different signs combined together to form a new array.


<type>[ ] [ ]<name>= new <type>[ rows] [];

Int [ ] [ ] arr = new int [3][ ];

Int[ ] [ ] arr = { list of values ];


While  declaring  a jagged  array in  that initial declaration we can only specified no of row the new no of row to the array and then are need to specified the column to each row individual.

Initialization of jagged array

arr[0] = new int [ 4 ]

arr[0] = new int [ 6 ]

Benifit of jagged array

  • Minimise of space .
  • Minimize of code .
Join Our WhatsApp Channel Join Now
Join Our Telegram Group Join Now

Leave a Comment