Graphical Analysis of Pass-By-Value and Pass-By-Reference

Figures 8.88.9 analyze graphically the execution of Fig. 8.6 and Fig. 8.7, respectively. In the diagrams, the values in rectangles above a given expression or variable represent the value of that expression or variable. Each diagram’s right column shows functions cubeByValue (Fig. 8.6) and cubeByReference (Fig. 8.7) only when they’re executing.

Image
Image

Fig. 8.8. Pass-by-value analysis of the program of Fig. 8.6.

Fig. 8.9. Pass-by-reference analysis of the program of Fig. 8.7.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.