TAL Programmer's Guide

Using Parameters
Using Procedures
11–26 096254 Tandem Computers Incorporated
Addresses and Pointer Contents as Value Parameters
You can pass the address of a variable or the content of a pointer as an actual value
parameter. The called procedure can then assign the address to a pointer.
In the actual parameter list, prefix the identifier of the variable or pointer with the @
operator:
INT .EXT array1[0:9];
INT .EXT array2[0:9];
INT .EXT ptr := @array2[9];
PROC move1 (x, y);
INT(32) x;
INT(32) y;
BEGIN
INT .EXT xptr := x;
INT .EXT yptr := y;
INT i;
FOR i := 0 TO 9 DO
yptr[i] := xptr[i];
END;
PROC m1 MAIN;
BEGIN
CALL move1 (@array1, @ptr); !Pass address of ARRAY1
END; ! and content of PTR
The following example is equivalent to the preceding example:
INT .EXT array1[0:9];
INT .EXT array2[0:9];
INT .EXT ptr := @array2[9];
PROC move2 (x, y);
INT .EXT x;
INT .EXT y;
BEGIN
INT .EXT xptr := @x;
INT .EXT yptr := @y;
INT i;
FOR i := 0 TO 9 DO
yptr[i] := xptr[i];
END;
PROC m2 MAIN;
BEGIN
CALL move2 (array1, ptr);
END;