Instructions

173 C-Control Pro IDE
© 2013 Conrad Electronic
In some cases expressions must be constant in order to be valid. E. g. also see Declaration of Ar-
ray Variables.
4.2.3 Data Types
Values always are of a certain data type. Integer values (integral values; whole numbered values) in
CompactC are of the 8, 16 or 32 Bit wide data type, floating point values are always 4 byte long.
Data Type
Sign
Range
Bit
char
Yes
-128 ... +127
8
unsigned char
No
0 ... 255 8
8
byte
No
0 ... 255 8
8
int
Yes
-32768 ... +32767
16
unsigned int
No
0 ... 65535
16
word
No
0 ... 65535
16
long (no Mega32)
Yes
-2147483648 ...
2147483647
32
unsigned long (no
Mega32)
No
0 ... 4294967295
32
dword (no Mega32)
No
0 ... 4294967295
32
float
Yes
±1.175e-38 to ±3.402e38
32
As one can see the data types "unsigned char" and byte, "unsigned int" and
word as well as "unsigned long" and dword are identical.
Due to size restrictions of the interpreter, 32-Bit Integer are not available on
the Mega32.
Strings
There is no explicit "String" data type. A string is based on a character array. The size of the array
must be chosen in such a way that all characters of the string fit into the character array. Addition-
ally some space is needed for a terminating character (decimal Zero) in order to indicate the end of
the character string.
Type Conversion
In arithmetic expressions it is very often the case that individual values are not of the same type. So
the data types of the following expression are combined (a is of type integer variable).
a + 5.5
In this case a is first converted into the data type float and then 5.5 is added. The
data type of the result is also float. For data type conversion there are the following
rules:
If in a linkage of 8 Bit or 16 Bit integer values one of the two data types is sign afflic-
ted ("signed") then the result of the expression is also sign afflicted. I. e. the opera-