O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

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

Pointers and Memory

The technique of using pointers to memory blocks comes into its own when creating lists of user-defined data structures and, in particular, a linked list of items. This is due to the nature of pointers as references that can be changed without needing to manipulate the data that they are pointing at explicitly.

In other words, you can sort an entire list of items just by swapping references to them, whether they are in an array or in a block of memory. If you’re not using pointers, the same operation requires that a copy of the data be taken and stored and the contents of that item be overwritten with the contents of another, and then the stored data restored to a different place.

Pointers simply make life easier, and one ...

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