数组赋值

//
var
  a1,a2:array[0..5]of integer;
  i:integer;
begin
  for i:=Low(a1) to High(a1) do
      a1[i]:=i;
     Move(a1,a2,SizeOf(a1));
     a1[3]:=255;
    //CopyMemory(@a2[0], @a1[0], Length(a1));
     ShowmessageFmt('%D',[a1[3]]);   //255
     ShowmessageFmt('%D',[a2[3]]);   //3
end;
/////

a2:=a1;   //简单的指针引用 a2指针指向a1的内存地址

var
 str1,str2:array of char;
begin
  SetLength(str1,10);
  SetLength(str2,10);
  str1[6]:=#65;
  str2:= Copy(str1, 0, 9);
  ShowMessage(str2[6]);   //A
  str1[6]:=#66;          //B
  ShowMessage(str2[6]);   //A
end;


你可能感兴趣的:(数组赋值)