3

I already know, or rather read what are they good for, but I don't get it.

Jagged arrays are useful for modeling sparse data structures where you might not always want to allocate memory for every item if it is not going to be used

Would someone please help me understand it? & please provide examples & real life situations where you make decisions and weigh the use of jagged arrays against something else like arrays.

TaW
  • 53,122
  • 8
  • 69
  • 111
Sam
  • 489
  • 5
  • 22
  • Probably already answered here as well - http://stackoverflow.com/questions/4648914/why-we-have-both-jagged-array-and-multidimentional-array – Gyanendra Dwivedi Aug 10 '15 at 06:36
  • 1
    Imagine an array of classes, each consisting of an array of students. With a jagged array each can have just the right size, with a 2d array each must have the same, maximum size. – TaW Aug 10 '15 at 06:42

0 Answers0