In the help it states:
An entire array may be made PRIVATE, following which it is in an undimensioned state. Before the private array can be used within the function or procedure it must be re-dimensioned using a DIM statement. The new dimensions can be the same as or different from those of the original array. PRIVATE arrays are allocated on the heap, but can be accessed only in the function or procedure in which they are declared. [emphasis added]
This seems to imply that the array can/should be re-dimensioned each time with either the same or different dimensions.
However, can any explain why this isn't working?
Code: Select all
FOR I% = 0 TO 9
PROCTEST(I%)
NEXT
END
DEF PROCTEST(B%)
PRIVATE C%, A%()
DIM A%(B%)
FOR C%=0 TO B%
PRINT ; A%(C%) ;
NEXT
PRINT
ENDPROC
Matt
EDIT: in fact further testing seems to indicate that the array (providing it is the same size) does not have to be re-Dimmed - only the first time. (This was tested using a conditional clause that indicated a return use.)