A Word About Memory
When you declare an array, you tell the compiler exactly how many objects you expect to store in it. The compiler sets aside memory for all the objects, even if you never need to use it. This isn't a problem with arrays for which you can estimate how many objects you'll need. For example, a chessboard has 64 squares, and CATs generally have between 1 and 10 kittens. When you have no idea of how many objects you'll need, however, you must use more advanced data structures.
This book looks at arrays of pointers, arrays built on the heap, and various other collections. More advanced data structures that solve large data-storage problems are beyond the scope of this book. Two great things about programming are that there are always ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access