VMS Help
PASCAL, Data Types, Pointer Types

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  A pointer type allows  you  to  refer  to  a  dynamic  variable.
  Dynamic  variables  do  not  have  lifetimes  that  are strictly
  related to the scope of a routine, module, or program;  you  can
  create  and  eliminate  them  at  various  times  during program
  execution.  Also, pointer types clearly define the  type  of  an
  object,  but  you can create or eliminate objects during program
  execution.  A pointer type has the following syntax:

     ^[[attribute-list]] base-type-identifier

  The 'attribute-list' is one or more  optional  identifiers  that
  provide additional information about the base type.

  The 'base-type-identifier' is the type identifier of the dynamic
  variable to which the pointer type refers.  (If the base type is
  an undiscriminated  schema  type,  you  need  to  supply  actual
  discriminants when you call the NEW function.)

  Unlike  other  variables,  dynamic   variables   do   not   have
  identifiers.  Instead, you access them indirectly with pointers.

  Call  the  NEW  procedure  to  allocate  storage   for   dynamic
  variables.   Call  the  DISPOSE  procedure  to  deallocate  this
  storage.

  Example:  TYPE
            Reservation = RECORD
              Name  : VARYING[30] OF CHAR;
              Class : ( standby, coach, first );
              Flight_number  : INTEGER;
              Next_passenger : ^Reservation;
              END;

            VAR
             Ticket : Reservation;

  In this example, 'Next_passenger' is a  pointer  to  the  record
  type  'Reservation'.   The variable 'Ticket' is declared as type
  'Reservation'.    By   manipulating   the   pointer    variable,
  'Ticket.Next_passenger', a linked list of records can be created
  using these definitions.

  Additional Information (explode) :

  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.