其他分享
首页 > 其他分享> > 有序类型的大小及最大、最小值

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

作者:互联网

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

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;
posted on 2007-11-30 17:32  万一  阅读(3382)  评论(2)  编辑  收藏

标签:IntToStr,最小值,Cardinal,Low,有序,类型,SizeOf,ShowMessage
来源: https://blog.51cto.com/u_14617575/2746752