Example: VAR Ppa: POINTER;
The syntax of the declaration is:
<pointer type identifier> = ^<type identifier>
It defines a new pointer type to element values of the identifier
type, which may be a simple or structured type.
Example:
Ptra = ^Train;
Train = Record
Engine: STRING[6];
Wagon: ARRAY[1 .. 16] of REAL;
Follows: Ptra;
END;
If PTrain: Ptra is declared in the VAR subsection
of DECL, then the pointer variable PTrain
is supposed to point to a record with the shown structure.
The variable PTrain^.Wagon[3] refers to the third array
element of the field Wagon of the Train type record
pointed by PTrain. These user's declared records are seldom used in GLIDER because messages suffices for almost all the uses and they are internally handled by GLIDER instructions and procedures.
Pointer variable value assignment results from dynamic memory
allocation (Pascal procedure NEW) or from direct assignment of
memory addresses values, as returned by function ADDR( ), for
instance.
Pointer variables must be carefully used.