Call by reference
Pascal
C/C++
w
procedure p(var x: integer);
w
w
begin
w
x := 17;
w
end;
w
w
w
p(i);
w
TRADITIONAL C:
w
void p(x)
w
int *x;
w
{
*x = 17;
w
}
w
w
w
p(&i);
This routine is called by:
In Pascal program in p(i), i is an integer variable.
The point of reference variables and functions is that you can pass a variable as a parameter and have the variable changed in the function.