Summary
In this chapter, we learned how a pointer is a variable that points to or references a value at a named location. To use a pointer, we have learned that we must know, either through definition or through casting, the type of the pointer's target, as well as the address of the target. Pointers should always be initialized to a named location or set to NULL
. We have explored the relatively few operations on pointers – assignment, access (dereference), and comparison. We will later explore pointer arithmetic. We have also extended the idea of pointers to variables to include pointers to structures and their elements. We have also seen how we can use pointers to provide greater flexibility in passing and manipulating function parameters.
This chapter is essential to understanding the next chapter, Chapter 14, Understanding Arrays and Pointers, where we will extend our concepts of using pointers to arrays. We will see how to access and traverse...