Instructions
197 C-Control Pro IDE
© 2013 Conrad Electronic
Dim f As Single
s=SizeOf(f) ' the value of s is 4
With arrays only the Byte length of the basic data type is returned. On order to calculate the
memory consumption of the array the value must be multiplied by the number of elements.
Array Variables
If behind the name, which in case of a variable definition is set in parenthesis, a figure value is written
then an array has been defined. An array will arrange the space for a defined variable manifold in
memory. With the following example definition
Dim x(10) As Integer
a tenfold memory space has been arranged for variable x. The first memory space can be addressed
by X[0], the second by x[1], the third by x[2], … up to x[9]. When defining of course other index
dimensions can also be chosen. The memory space of C-Control Pro is the only limit.
Multi dimensional arrays can also be declared by attaching further indices during variable definition,
which have to be separated by commas:
Dim x(3,4) As Integer ' array with 3*4 entries
Dim y(2,2,2) As Integer ' array with 2*2*2 entries
Arrays may in BASIC have up to 16 indices (dimensions). The maximum value for an index is
65535. The indices of arrays are in any case zero based, i .e. each index will start with a 0.
Only if the compiler option "Check Array Index Limits" is set, there will be a verification whether
or not the defined index limits of an array have been exceeded. Otherwise, if an index becomes too
large during program execution the access to alien variables will be tried which in turn may create a
good chance for a program breakdown.
Table support by predefined Arrays
Since version 2.0 of the IDE arrays can be predefined with values:
Dim glob(10) = {1,2,3,4,5,6,7,8,9,10} As Byte
Flash fglob(2,2)={10,11,12,13} As Byte
Sub main()
Dim loc(5)= {2,3,4,5,6} As Byte
Dim xloc(2,2) As Byte
xloc= fglob
End Sub
Because there is more flash memory than RAM available, it is possible with the flash keyword to
define data that are written in the flash memory only. These data can be copied to a RAM array with
same dimensions with an assignment operation. In this example this is done through "xloc= fglob".