Defines a general use Pointer to any memory based data System unit
  type Pointer;
The Pointer type provides a general use pointer to any memory based variable. That is, one that is accessed by reference.
Objects, AnsiStrings, and arrays are examples of reference based variables.
But be warned : untyped pointers are dangerous - it is normally always better to use a specific pointer reference to the data type you are using. Only then can you act up on the pointer, as in the example.
Related commands
PAnsiChar A pointer to an AnsiChar value
PAnsiString Pointer to an AnsiString value
PChar A pointer to an Char value
PCurrency Pointer to a Currency value
PDateTime Pointer to a TDateTime value
PExtended Pointer to a Extended floating point value
PInt64 Pointer to an Int64 value
PShortString A pointer to an ShortString value
PString Pointer to a String value
PVariant Pointer to a Variant value
PWideChar Pointer to a WideChar
PWideString Pointer to a WideString value
 Author links

 Download this web site as a Windows program.

Example code : Referring to the current form using a Pointer variable
  generalPtr : Pointer;  // A pointer to anything
  formPtr    : ^TForm;   // A pointer to a form object

  // The current unit's form is addressable via the self keyword
  generalPtr := Addr(self);

  // We can assign this pointer to the form pointer
  formPtr := generalPtr;

  // And set the form caption to show this
  formPtr.Caption := 'Test program';
Show full unit code
   The form is shown with caption:
   Test program
Delphi Programming Neil Moffatt 2002 - 2020. All rights reserved.  |  Home Page