Array out of range / ArrayResize problem (yes again im sorry) - page 2

 

The problem is your program logic to resize the array there is something wrong.

Go through your code using the debugger and look always at the size of your arrays when where and how do you change it!

 

try to print the size of the array

 

Solved thanks gooly and ffoorr for your input.

 

My problem was using the ArrayResize variable when setting the Array values without a de-increment -1 to align with Array index sequence. 

 

So I was using this:

ArrayResize(Closed,++closecnt);
Closed[closecnt][0] = "one";

 

When the correct method is:

 

ArrayResize(Closed,++closecnt);
Closed[closecnt-1][0] = "one";
 
yep that's right
 
This is wrong. You want to increase the size to one and set element zero
    closecnt=closecnt++;
    ArrayResize(Closed,closecnt);
:
    Closed[closecnt][0]="one";
Like this.
//    closecnt=closecnt++;
    ArrayResize(Closed,closecnt+1);
:
    Closed[closecnt][0]="one";
    ++closecnt; // Now you have one.
 
Got it thanks WHRoeder :-)
Reason: