Instructions
175 C-Control Pro IDE
© 2013 Conrad Electronic
Floating Point Figures (data type float) may contain a decimal point and an exponent.
float x,y;
x=5.70;
y=2.3e+2;
x=-5.33e-1;
sizeof Operator
By the operator sizeof() the number of Bytes a variable takes up in memory can be determined.
Examples:
int s;
float f:
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 brackets, 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
int x[10];
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 brackets during variable definition:
int x[3][4]; // array with 3*4 entries
int y[2][2][2]; // array with 2*2*2 entries
Arrays may in CompactC 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: