Chapter
3:
Programming
the
VIC
20
Computer 79
A(O)
1-----1
A(I)
1-----1
A(2)
1-----1
A(3)
1------1
A(4)
a..-
__
....
The number of elements in the array is equal
to
the highest index
number plus
1.
This takes array element 0 into account.
A two-dimension array element has the following form:
name(i,
j)
where
name
is
the variable name
of
the array
i
is
the column index
j
is
the row index.
A two-dimension string array called A$, having two column elements
and three row elements, might be visualized as follows:
AS(O,O)
AS(O,I)
~---+----t
AS(I,O) AS(I,I)
AS(2,O)
AS(2, I)
The size
of
the array
is
the product
of
the highest row dimension plus
1,
multiplied by the highest column dimension plus
1.
For
the array above, it
is
3 X 2 = 6 elements.
Additional dimensions can be added to the array.
name (iJ,k, ... )
Arrays
of
as many as
11
elements (index 0 to
10
for a single-dimension
array) may be used routinely in VIC BASIC. Arrays containing more than
11
elements need to be specified in a dimension statement. Dimension
statements are described later in this chapter.
If
you do not enter the
SUbscript for an array in your program, it will be treated as a separate
variable by VIC BASIC. This can lead to hard-to-find bugs in your pro-
gram. You should not exploit this distinction in your programs: Other
languages and other dialects
of
BASIC do
not
work in the same way. This