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 References

A pointer can point to an instance of a variable, the start of a memory block, or even a function. It can also point to other pointers, but that topic is beyond the scope of this book. The most common example of this is an array of pointers—such as the argv parameter that you saw in the strings discussion.

In a program, you can refer to a pointer (the pointer itself) or the value in memory that it is pointing to. Operations on a pointer have a different effect than operations on the value that it refers (or is pointing) to. You can, for example, move through an array of integers pointed to by a variable by incrementing the pointer.

To access the value pointed at, though, you would need to dereference the pointer to reveal ...

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