有序类型的大小及最大、最小值

procedure TForm1.Button1Click(Sender: TObject);
var
  b: Byte;
  w: Word;
  i: Integer;
  c: Cardinal;
begin
  ShowMessage(IntToStr(SizeOf(b)));  //Byte大小:1
  ShowMessage(IntToStr(High(b)));    //Byte最大值: 255
  ShowMessage(IntToStr(Low(b)));     //Byte最小值: 0

  ShowMessage(IntToStr(SizeOf(w)));  //Word大小:2
  ShowMessage(IntToStr(High(w)));    //Word最大值: 65535
  ShowMessage(IntToStr(Low(w)));     //Word最小值: 0

  ShowMessage(IntToStr(SizeOf(i)));  //Integer大小:4
  ShowMessage(IntToStr(High(i)));    //Integer最大值: 2147483647
  ShowMessage(IntToStr(Low(i)));     //Integer最小值: -2147483648

  ShowMessage(IntToStr(SizeOf(c)));  //Cardinal大小:4
  ShowMessage(IntToStr(High(c)));    //Cardinal最大值: 4294967295
  ShowMessage(IntToStr(Low(c)));     //Cardinal最小值: 0
end;

你可能感兴趣的:(有序类型的大小及最大、最小值)