In many languages, a pointer points to a specific type of record (and only that type). A pointer typically is the memory address of the record it points to.

In Pascal, a pointer is specified using the symbol ^ preceding the type pointed to.

     cons = record car : integer;
                   cdr : ^cons  end;

In C++ and Java, a pointer is specified by * following the type; if l is a pointer to a cons, it is declared as:

   cons *l

The special value nil (Common Lisp, Pascal), NULL (C++) or null (Java) is used for a pointer that does not point to any record; null may be represented internally by a special pointer value, such as 0 . A test similar to the null? test of Scheme is done by testing for equality with the NULL value:

   while ( l != NULL ) ...

Contents    Page-10    Prev    Next    Page+10    Index