qb45advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Static and Dynamic Arrays
◄Data Types► ◄Static and Dynamic Arrays► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
Static and Dynamic Arrays
You can get better control of your program's use of memory by controlling
when storage is set aside for arrays. Storage for arrays can be set aside
when the program is compiled or when the program is running.
■ Arrays given storage when the program is compiled are static
arrays.
■ Dynamic arrays have storage set aside when the program is run.
The storage taken by dynamic arrays can be eliminated when it is
needed in order to free memory for other uses.
How an array is declared can determine whether the array is static or
dynamic.
■ Arrays dimensioned with constant subscripts, or arrays that are
implicitly dimensioned, are static arrays.
■ Arrays dimensioned with variable subscripts, or that are first
declared in a COMMON statement, are dynamic arrays.
■ In a SUB or FUNCTION not declared STATIC, all arrays are dynamic.
You can also use the $STATIC and $DYNAMIC metacommands to control how array
storage is allocated. However, the $STATIC metacommand cannot force arrays
to be static in a procedure not declared STATIC; in such a procedure all
arrays are dynamic.