我看了delphi的帮助,但还不理解其中意思。
像下面这个例子,其结果是怎么得来的?
var
   A:array [1..4] of char;
   B:integer;
begin
   A:='ABCD';
   move(A,B,sizeof(B));
   showmessage('A='+A+#13#10'B='+IntToStr(B));
end;结果显示:
          A=ABCD
          B=1145258561请问其中B的结果是怎么得来的?

解决方案 »

  1.   

    A => 41H
    B => 42H
    C => 43H
    D => 44H内存排布为
    DCBA =>44 43 42 4144434241H => 1145258561D所以B的内容为 1145258561---------------------------------------------------------------------------------
    procedure Move(const Source; var Dest; Count: Integer);DescriptionMove copies Count bytes from Source to Dest. No range checking is performed. Move compensates for overlaps between the source and destination blocks. Whenever possible, use SizeOf to determine the count.
      

  2.   

    同意jacky_shen(jacky)。procedure Move(const Source; var Dest; Count: Integer);move 就是把Count 字节的数据从变量Source 所指的位置拷贝倒Dest 所指的位置,这是在进行内存复制。类似于C 语言里面的memcpy