BASCOM Errata 

Defining Arrays

An array is a set of sequentially indexed elements having the same type. Each element of an array has a unique index number that identifies it. Changes made to an element of an array do not affect the other elements.
The index must be a numeric constant, a byte, an integer , word or long. The maximum number of elements is 65535. The first element of an array is always one. This means that elements are 1-based.
Arrays can be used on each place where a 'normal' variable is expected.

 

Important

The number of elements must be known during compile time.


Defining an array with 10 element

Dim A(10) As Byte   'correct
 
Const Cl = 10
Dim B(cl) As Byte   'correct
 
Dim Vl As Byte
vl = 10
Dim C(vl) As Byte   'not allowed

The book contains some not allowed array definitions (look to MEAN.BAS). With the used compiler version that definitions worked because no other definition of variables followed.
The actual compiler version detects an access to a variable defined in the third way!

2001-10-06


Last change:2001-10-06