Declaring Dynamic Arrays
◄10 Questions► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
How do I declare a dynamic array?
You can do this five different ways:
1. Use the $DYNAMIC metacommand before declaring the array:
REM $DYNAMIC
DIM MyArray(1 TO 100) AS STRING * 16
2. Declare the array with a variable or expression:
X = 100
DIM MyArray(X) AS STRING * 16
3. Declare the array after it is declared in a COMMON statement:
COMMON SHARED MyArray() AS STRING * 16
DIM MyArray(1 TO 100) AS STRING * 16
4. Use the REDIM statement.
5. Use DIM within a SUB procedure; this always creates a dynamic array.