March 2010
Beginner
760 pages
18h 51m
English
Before you can access elements of an array, you need to set aside storage for that array. Fortunately, array declarations build on the declarations you've already seen. To allocate n elements in an array, you would use a declaration like the following in one of the variable declaration sections:
ArrayName:basetype[n];
ArrayName is the name of the array variable and basetype is the type of an element of that array. This sets aside storage for the array. To obtain the base address of the array, just use ArrayName.
The [n] suffix tells HLA to duplicate the object n times. Now let's look at some specific examples.
static CharArray: char[128]; // Character array with elements 0..127. ByteArray: byte[10]; // Array ...