Passing Data to Functions
When function calls have to be made, it becomes important to find out how this can be done as efficiently as possible. When you look at how functions receive their parameter data, there are basically three options to choose from:
Passing parameters by value
Passing parameters by reference
Using global data
This section examines in detail how to get data to functions via these three methods.
Pass by Reference Versus Pass by Value
As was shown in the previous section, parameters which are passed to a function are placed onto the stack before the function call is made. If a parameter is an integer, the integer is placed on the stack. If a parameter is a pointer to an integer, a pointer to an integer is placed on ...
Get C++ Footprint and Performance Optimization now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.