Page 1 of 1

Resizing an array multiple times

PostPosted: June 28th, 2007, 12:40 am
by Wardlow
Here's an example of how I'm resizing an array:
SetLength(High_, size); SetLength(Low_, size);

Is it possible to re size this array later on the program where I might have a line of code
SetLength(High_, size2); SetLength(Low_, size2); ???


Thanks
Wardlow

PostPosted: June 28th, 2007, 4:27 am
by Johnny_Bit
Why dont you try it?

PostPosted: June 28th, 2007, 4:31 am
by Wardlow
I did I get an error

PostPosted: June 28th, 2007, 4:46 am
by Wardlow
uh oh, you're right. It worked sorry about that ridiclous post

PostPosted: June 28th, 2007, 8:09 pm
by Wardlow
One more ? about this.

Code: Select all
if count = 0  then
SetLength(MyArray, size);
MyArray[i] := x;

if count = 1 then
SetLength(MyArray, size2);


I'm having this MyArray go through a loop, when the loop is over I use the function SetLength(MyArray, x). Does this Reset MyArray to 0?

PostPosted: June 29th, 2007, 7:06 am
by Johnny_Bit
No, if new length is not 0 then data in your array should be untouched.