var s:string;
begin
   showmessage(inttostr(sizeof(s)));
end;
结果是4,
怎么的出来的?
请教解答!!在线等=======谢谢各位!!

解决方案 »

  1.   

    SizeOf,返回一个类型所占用的字节数
    string类型占用4个字节
      

  2.   

    http://blog.csdn.net/zzz822163/archive/2008/11/14/3298285.aspx
      

  3.   


    var
      i:Integer;
      b:Byte;
      c:string;
      d:Double;
    begin
      ShowMessage(IntToStr(SizeOf(i)));   //4
      ShowMessage(IntToStr(SizeOf(b)));   //1
      ShowMessage(IntToStr(SizeOf(c)));   //4
      ShowMessage(IntToStr(SizeOf(d)));   //8
    end;