[fpc-pascal] Question about Deleting elements in Dynamic Array
Bihar Anwar
bihar_anwar at rocketmail.com
Tue Apr 27 15:42:21 CEST 2010
Just say, I have a dynamic array with size=5, and I want to delete elements from the index 0 to 2. Is there a trick (the fastest way) to delete those elements (0 to 2) without moving activities?
I've tried to make the dynamic array just pointing to 3rd element and set a new length for it, but fpc generates an unhandled exception.
var
a: array of string;
SetLength(a, 5);
a[0] := 'aa'; a[1] := 'bb'; a[2] := 'cc'; a[3] := 'dd'; a[4] := 'ee';
a := @sl[3]; // this is the trick, but it doesn't work.
SetLength(a, 2)
Thank's in advance.
More information about the fpc-pascal
mailing list