PROGRAM
VAR i,j: INTEGER;
PROCEDURE foo(x,y)
BEGIN
i:=y
END;
BEGIN
i:= 2; j:= 3;
foo( i,j)
END
In Pass-by-Value-Result, x is a synonym for i on the call, but the value of x is never changed, so the changed value of i is restored to the original value when returning from the function.
In Pass-by-Reference the change to i is kept back in the main program.
[CS Dept.] [UIC]
[Prof. Reed]