- Arguments are passed from the calling function to the called
function in two possible ways:
- by value
- by reference
- Passing by value (default): the calling function makes a
copy of the argument and passes the copy to the called function;
the called function cannot change the argument
double performSum(double op1, double op2);
- Passing by reference (prepend a &): the calling function
passes the argument directly to the called function; the
called function can change the argument
void increaseArgument(double& arg) { arg++; }
Leo Liberti
2008-01-12