bas7qck.hlp (Table of Contents; 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.
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.