[next] [previous] [contents]

  7.2 Creating Arrays Explicitly
  You can create arrays explicitly with four BASIC statements:
  DECLARE, DIMENSION, COMMON, and MAP.

  In addition, you can declare arrays as components of a record
  data type. See
Chapter 9 for more information about records.

  Normally, you use the DECLARE statement to create arrays.
  However, you may want to create the array with another
  BASIC statement as follows:

  .
        Use the DIM statement to create virtual arrays and
        arrays that can be redimensioned at run time.
  .
        Use the COMMON statement to create arrays that can
        be shared among program modules or to create arrays of
        fixed-length strings.
  .
        Use the MAP statement to create an array and associate
        it with a record buffer, or to overlay the storage for an
        array, thus accessing the same storage in different ways.

  When you create an array, the bounds you specify determine
  the array's size. The maximum value allowed for a bound
  can be as large as 2147483467; however, this number is ac-
  tually limited by the amount of virtual storage available to
  you. Very large arrays and arrays with many dimensions
  can cause fatal errors at both compile time and run time.

  The following restrictions apply to arrays:

  .
        When referencing an array, you must use the same
        number of subscripts as was specified when the array
        was created.
  .
        You can use identical names for a simple variable and
        an array; for example, A% and A%(5,5). However, this
        is not a recommended programming practice. If you use
        identical names for arrays with a different number of
        subscripts, for example, A(5), and A(10,10), BASIC prints
        the error ``Inconsistent subscript usage'' at compile time.
  .
        If subscript checking is enabled, BASIC signals the error
        ``Subscript out of range'' (ERR=55) if you reference an
        array element whose subscripts are one of the following:

        - Greater than the current upper bound of the array
        - Less than the current lower bound of the array
        - Less than zero where no lower bound was specified