O'Reilly logo

Imperfect C++ Practical Solutions for Real-Life Programming by Matthew Wilson

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

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 ...

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