Home Segments Index Top Previous Next

551: Mainline

Although C++ programs normally adhere to the call-by-value convention, C++ allows you to stipulate that you want particular parameters to be call-by-reference parameters. Whenever a call-by-reference parameter is paired with an argument that is a single-variable expression, the parameter shares the memory chunk named by the variable; nothing is copied:

Memory reserved for             Memory for 
argument variable               corresponding parameter 
 |                               | 
 | *-----------------------------* 
 | | 
 v v                               
*-----*-----*-- 
|     |     | 
*-----*-----*---