Description |
The PInt64 type is a pointer to an Int64 value.
Pointer arithmetic, such as Inc, Dec can be used on it, for example to navigate a block of Int64 values, as in the example.
|
|
Related commands |
Dec |
|
Decrement an ordinal variable |
Inc |
|
Increment an ordinal variable |
Int64 |
|
A 64 bit sized integer - the largest in Delphi |
|
|
|
Example code : Store 3 Int64 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
int64Ptr : PInt64;
a : TDateTime;
begin // Allocate storage for three Int64 variables
GetMem(int64Ptr, 3 * SizeOf(Int64));
// Fill out these Int64 variables
int64Ptr^ := 1;
Inc(int64Ptr);
int64Ptr^ := 22;
Inc(int64Ptr);
int64Ptr^ := 333;
// Now display these values
Dec(int64Ptr, 2);
ShowMessageFmt('Value 1 = %d',[int64Ptr^]);
Inc(int64Ptr);
ShowMessageFmt('Value 2 = %d',[int64Ptr^]);
Inc(int64Ptr);
ShowMessageFmt('Value 3 = %d',[int64Ptr^]);
end; end.
|
Hide full unit code |
Value 1 = 1
Value 2 = 22
Value 3 = 333
|
|