qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
BYREF.PAS
  Example Contents Index                                    Back
 
PROGRAM byref;
 
{ BYREF.PAS : Demonstrates passing by reference. }
 
VAR
    var1, var2 : Integer;
 
PROCEDURE swap_vars( VAR var1: Integer; VAR var2: Integer );
VAR
    temp : Integer;
BEGIN
    temp := var1;
    var1 := var2;
    var2 := temp;
END; { procedure swap_vars }
 
BEGIN
 
    var1 := 55;
    var2 := 99;
    Writeln( 'var1 = ', var1, '  var2 = ', var2 );
    swap_vars( var1, var2 );
    Writeln( 'var1 = ', var1, '  var2 = ', var2 );
 
END.