Summary
This chapter deals with rather complex material. You looked at several uses of pointers in C++. The first one was to use pointers to point to ordinary variables allocated on the stack and to provide an alternative technique of accessing these variables through aliasing. With the exception of passing parameters by pointer (which I will discuss in the next chapter) this technique is useless. However, some programmers believe that this technique makes their code easier to understand. Make sure you are ready to deal with this kind of pointer manipulation in legacy code.
The second use of pointers is allocating individual variables on the stack rather than on the heap. The heap variables do not have names, and the use of pointers provides ...
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