Description |
The PCurrency type is a pointer to a Currency value.
Pointer arithmetic, such as Inc, Dec can be used on it, for example to navigate a block of Currency values, as in the example.
|
|
Related commands |
Currency |
|
A floating point type with 4 decimals used for financial values |
Dec |
|
Decrement an ordinal variable |
Inc |
|
Increment an ordinal variable |
|
|
|
Example code : Store 3 Currency values in memory and navigate through them |
var
currPtr : PCurrency;
begin // Allocate storage for three currency variables
GetMem(currPtr, 3 * SizeOf(Currency));
// Fill out these currency variables
currPtr^ := 123.45;
Inc(currPtr);
currPtr^ := 2.9;
Inc(currPtr);
currPtr^ := 87654321;
// Now display these values
Dec(currPtr, 2);
ShowMessageFmt('Currency 1 = %m',[currPtr^]);
Inc(currPtr);
ShowMessageFmt('Currency 2 = %m',[currPtr^]);
Inc(currPtr);
ShowMessageFmt('Currency 3 = %m',[currPtr^]);
end;
|
Show full unit code |
Currency 1 = ?123.45
Currency 2 = ?2.90
Currency 3 = ?87,654,321.00
|
|