Chapter 14. Arrays and Pointers
An array is “a fixed collection of same-type data . . . [logically] stored contiguously and . . . accessible by an index” [Sedg1998a], and is one of the fundamental data structures [Knut1997]. While most languages have arrays, many modern ones do not have pointers because they are deemed too dangerous. Pointers allow direct access to the memory locations of the instances to which they point, but they can, and often do, lead to memory corruption. Nonetheless C and C++ provide pointers because they afford such power and opportunity for efficiency, in keeping with the “Spirit of C” (see Prologue).
In this chapter, we look at some issues where the language(s) leave something to be desired, including the issues of array ...
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