[fpc-pascal] Copy dynamic array

Torsten Bonde Christiansen tc at epidata.info
Mon May 14 11:46:08 CEST 2018


Hi List.

This i a real newbie question:

I hardly use dynamic array, so I don't know if there is a simpler method 
to copying a dynamic interger array than the straigh forward method:

(I need a copy to preseve the current values of OldArray, since OldArray 
will change values later in the program)

SetLength(NewArray, Length(OldArray));
for i := Low(OldArray) to High(OldArray) do
   NewArray[i] := OldArray[i];


Best regards,
Torsten.



More information about the fpc-pascal mailing list