7. Embedded QUEL for Pascal : Pascal Variables and Data Types : Variable and Type Declarations : Pointer Type Definition
 
Share this page                  
Pointer Type Definition
The declaration for a pointer type definition has the following syntax:
type pointer_name =  ^type_name;
Syntax Note:
The type_name can be either a previously defined type or a type not yet defined. If the type has not yet been defined, the pointer type definition is a forward pointer definition. In that case, EQUEL requires that the type_name be defined before a variable of type pointer_name is used in an EQUEL statement.
The following example illustrates the use of the pointer type definition:
##  type
##    EmpPtr =^EmpRecord; 
##        {Forward pointer declaration}
##    EmpRecord = record
##         e_name : varying[40] of Char;
##         e_salary : Real;
##         e_id : Integer;
##         e_next : EmpPtr;
##    end;

##  var
##    empnode = EmpPtr;
        ...

##    retrieve (empnode^ .e_ename = emp.name,
##    empnode^.e_salary = emp.salary,
##    empnode^.e_id = emp.id)