CONTENTS | PREV | NEXT
8D. the array type (ARRAY)
--------------------------
ARRAYs are declared by specifying their length (in elements):
DEF b[100]:ARRAY
this defines an array of 100 bytes. Internally, 'b' is a variable of
type LONG and a PTR to this memory area.
Default type of an array-element is CHAR, it may be anything by specifying:
DEF x[100]:ARRAY OF LONG
DEF mymenus[10]:ARRAY OF newmenu
where "newmenu" is an example of a structure, called OBJECTs in E.
Array access is very easy with: <var>[<sexp>]
b[1]:="a"
z:=mymenus[a+1].mutualexclude
Note that the index of an array of size n ranges from 0 to n-1,
and not from 1 to n.
Note that ARRAY OF <type> is compatible with PTR TO <type>, with the
only difference that the variable that is an ARRAY is already
initialised.