O'Reilly logo

C# Data Structures and Algorithms by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Jagged arrays

The last variant of arrays described in this book is a jagged array, which is also referred to as an array of arrays. It sounds complicated, but fortunately, it is very simple. A jagged array could be understood as a single-dimensional array, where each element is another array. Of course, such inner arrays can have different lengths or they can even be not initialized.

If you take a look at the following diagram, you will see an example of a jagged array with four elements. The first element has an array with three elements (9, 5, -9), the second element has an array with five elements (0, -3, 12, 51, -3), the third is not initialized (NULL), while the last one is an array with only one element (54):

Before proceeding to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required