function do1(A:array of Integer): TIntegerDynArray;
begin
System.SetLength(Result, 3);
Result[0] := A[0];
Result[1] := A[1];
Result[2] := A[2];
end;
var
A: Array[0..2] of Integer;
B: TIntegerDynArray;
C: TIntegerDynArray;
I: Integer;
begin
A[0] := 1;
A[1] := 2;
A[2] := 3;
B := do1(A)
赋值?指针么?
C := do1(A)
赋值?指针么?
for I := 0 to 2 do
begin
Showmessage(Inttostr(B));
end;
end;
function do1: TIntegerDynArray;
var
A: TIntegerDynArray;
begin
System.SetLength(A, 3);
A[0] := 1;
A[1] := 2;
A[2] := 3;
Result := A;是指针
end;
procedure TForm1.Button1Click(Sender: TObject);
var
B: TIntegerDynArray;
C: TIntegerDynArray;
D: TIntegerDynArray;
I: Integer;
begin
B := do1;是指针
D := B;是指针
C := D
是指针
end;
z_cd 说的对动态数组赋值是指针。