POINTERS: Referencing data types that do not yet exist
The most common use of pointers is to reference structured types like records. Often, the record definition will contain a reference to the pointer,
type rptr = ^recdata; recdata = record number : integer; code : string; nextrecord : rptr end; var currentrecord : rptr;In this example, the definition for the field nextrecord of recdata includes a reference to the pointer of type iptr. As you can see, rptr is defined as a pointer of type recdata, which is defined on the next lines. This is allowed in Pascal, for pointer types.
Using a definition of recdata, this will allow us to create a list of records, as illustrated by the following picture.
In this case, a list is simply of number of records (all of the same type), linked together by the use of pointers.