Wanted
2011-02-21 19:27:12
var
A, B: TIntegerArray;
I: Integer;
begin
A := [5, 4, 3, 2, 1];
B := A;
QuickSort(B);
for I := 0 to High(A) do
WriteLn(A[I]);
end.I do not want it to sort A, just B.
What is the best way to avoid this?
Like other than this
var
A, B: TIntegerArray;
I: Integer;
begin
A := [5, 4, 3, 2, 1];
SetLength(B, Length(A));
for I := 0 to High(A) do
B[I] := A[I];
QuickSort(B);
for I := 0 to High(A) do
WriteLn(A[I]);
end.