7. Embedded QUEL for Pascal : Pascal Variables and Data Types : Variable Usage : Pointer Variables
 
Share this page                  
Pointer Variables
A pointer variable references an object in the same way as in Pascal—the name of the pointer is followed by a caret (^):
pointer_name^
Any further referencing required to fully qualify an object, such as a member of a pointed-to record, follows the usual Pascal syntax.
Syntax Notes:
1. The final object denoted by the pointer reference must be a scalar value (integer, floating-point or character string). There can be any combination of arrays, records or pointer variables, as long as the last object referenced has a scalar valuThe pointer reference is also used with file type variables.
In the following example, a pointer to an employee record is used to load a linked list of values into the Employee database table:
##  type
##      EmpLink = ^EmployeeRec;
##      EmployeeRec = record
##          ename: packed array [1..20] of Char;
##          eage: Integer;
##          eidno: Integer;
##          enext: EmpLink;
##      end;
##      elist: EmpLink;
        ...

    while (elist <> nil) do
    begin
##          repeat append to employee
##              (name = @elist^.ename, age = @elist^.eage,
##               idno = @elist^.eidno)
            elist := elist^.enext;
    end;