A pointer to an Char value System unit
type PChar = ^Char;
The PChar type is a pointer to an Char value.
It can also be used to point to characters within a string, as in the example code.
As with other pointers, integer arithmetic, such as Inc and Dec can be performed on a PChar variable, also shown in the example.
PChar is principally used when processing null-terminated (C-like) strings.

At the current time, Char variables are identical to AnsiChar variables, being 8 bits in size.
Related commands
$ExtendedSyntaxControls some Pascal extension handling
CharVariable type holding a single character
DecDecrement an ordinal variable
IncIncrement an ordinal variable
PAnsiCharA pointer to an AnsiChar value
PStringPointer to a String value
PWideCharPointer to a WideChar
 Download this web site as a Windows program.

Example code : Display all characters in a string
  myString  : string;
  myCharPtr : PChar;
  i : Integer;

  // Create a string of Char's
  myString  := 'Hello World';

  // Point to the first character in the string
  i := 1;
  myCharPtr := Addr(myString[i]);

  // Display all characters in the string
  while i <= Length(myString) do
Show full unit code
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page