DelphiBasics
Cardinal
Type
The basic unsigned integer type System unit
type Cardinal = 0..4294967295; // At the time of writing
Description
The Cardinal type is an Integer whose size is not guaranteed. It is the basic unsigned integer type in Delphi, and currently has the same capacity as the LongWord : 32 bits.
 
To hold very large integers, use the Int64 type.
Notes
Cardinal is most commonly used in parameter passing to C type functions.
Related commands
ByteAn integer type supporting values 0 to 255
Int64A 64 bit sized integer - the largest in Delphi
IntegerThe basic Integer type
LongIntAn Integer whose size is guaranteed to be 32 bits
LongWordA 32 bit unsigned integer
ShortIntAn integer type supporting values -128 to 127
SmallIntAn Integer type supporting values from -32768 to 32767
WordAn integer type supporting values 0 to 65535
 Download this web site as a Windows program.




 
Example code : Showing the capacity of Cardinal
var
  min, max : Cardinal;
begin
  // Set the minimum and maximum values of this data type
  min := Low(Cardinal);
  max := High(Cardinal);
  ShowMessage('Min cardinalvalue = '+IntToStr(min));
  ShowMessage('Max cardinalvalue = '+IntToStr(max));
end;

Show full unit code
  Min cardinal value = 0
  Max cardinal value = 4294967295
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page