DelphiBasics
PExtended
Type
Pointer to a Extended floating point value System unit
  type PExtended = ^Extended;
Description
The PExtended type is a pointer to a Extended value.
 
Pointer arithmetic, such as Inc, Dec can be used on it, for example to navigate a block of Extended values, as in the example.
Related commands
Dec Decrement an ordinal variable
Extended The floating point type with the highest capacity and precision
Inc Increment an ordinal variable
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Store 3 Extended values in memory and navigate through them
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  extPtr : PExtended;

begin
  // Allocate storage for three extended variables
  GetMem(extPtr, 3 * SizeOf(Extended));

  // Fill out these extended variables
  extPtr^ := 123.45;
  Inc(extPtr);
  extPtr^ := 2.9;
  Inc(extPtr);
  extPtr^ := 87654321;

  // Now display these values
  Dec(extPtr, 2);
  ShowMessageFmt('Value 1 = %f',[extPtr^]);
  Inc(extPtr);
  ShowMessageFmt('Value 2 = %f',[extPtr^]);
  Inc(extPtr);
  ShowMessageFmt('Value 3 = %f',[extPtr^]);
end;
 
end.
Hide full unit code
   Value 1 = 123.45
   Value 2 = 2.90
   Value 3 = 87654321.00
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page