Thursday, 20 March 2014

CALL BY REFERENCE

Call by reference with pointer arguments
–Pass address of argument using & operator
–Allows you to change actual location in memory
–Arrays are not passed with & because the array name is already a pointer
* operator 
–Used as alias/nickname for variable inside of function
void double(int *number)
{
*number = 2 * (*number);
}
*number used as nickname for the variable passed

No comments:

Post a Comment