Radio Shack TRS-80 PC-3 Owner's Manual page 129

Table of Contents

Advertisement

Use
Except for A(26) and A$(26), which are predefined (see Chapter 4), a DIM verb must be used to reserve space for any array
variable. An array variable and a simple variable may not have the same name. A sting array and a numeric array may have the
same name except for the dollar sign.
The maximum number of dimensions in any array is two: the maximum size of anyone dimension is 255. In addition to the
number of elements specified in the dimension statement, one additional "zeroeth" element is reserved. For example, Dim B(3)
reserves B(0), B{l), B(2), and B(3). In two-dimensional arrays, there is an extra "zeroeth" row and column.
In string arrays, one specifies the size of each string element in addition to the number of elements. For example, DIM B$(3)
*
12
reserves space for 4 strings which are each a maximum of 12 characters long. If the length is not specified, each string can contain
a maximum of 16 characters.
When a numeric array is dimensioned, all values are initially set to zero; in a string array the values are set to
NUL.
A{ ) and A${ ) may be dimensioned to sizes larger than 26 with the DIM statement.
In this case part of the array is in the
preallocated memory and part is in program memory. (See Chapter
4.)
Examples
10
DIM B(10)
20 DIM C$(4,4)
*
10
Reserves space for numeric array with 11 elements.
Reserves space for a two-dimensional string array with 5 rows and 5 columns: each string will be a maxi-
mum of 10 characters.
129

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents