TAL Reference Manual

Pointers
TAL Reference Manual526371-001
9-9
Examples of Structure Pointer Declarations
4. This example initializes a local or sublocal STRING structure pointer with the
address of a substructure:
STRUCT name_def(*);
BEGIN
STRING first[0:3];
STRING last[0:3];
END;
STRUCT .record;
BEGIN
STRUCT name (name_def); !Declare substructure
INT age;
END;
STRING .my_name (name_def) := @record.name;
!Structure pointer contains
!address of substructure
my_name ':=' ["Sue Law"];
5. This example declares an array, a structure, and a structure pointer at the local
level. The structure pointer refers to the structure but is initialized to point to the
array, thus imposing the structure on the array. You can now refer to the array in
two ways:
PROC a_proc MAIN;
BEGIN
INT array[0:7]; !Array
STRUCT a_struct (*); !Structure
BEGIN
INT var;
INT buffer1[0:3];
STRING buffer2[0:4];
END;
INT .struct_ptr (a_struct) := @array;
END; !Structure pointer contains
!address of array