Datasheet

INTEGER CONSTANTS
Integer constants can be decimal (base 10), hexadecimal (base 16), binary (base
2), or octal (base 8). In the absence of any overriding suffixes, the data type of an
integer constant is derived from its value.
Long and Unsigned Suffixes
The suffix L (orl) attached to any constant forces that constant to be represented as
a long. Similarly, the suffix U (or u) forces a constant to be unsigned. Both L and U
suffixes can be used with the same constant in any order or case: ul, Lu, UL, etc.
In the absence of any suffix (U, u, L, or l), a constant is assigned the “smallest”
of the following types that can accommodate its value: short, unsigned short,
int, unsigned int, long int, unsigned long int.
Otherwise:
- If a constant has the U suffix, its data type will be the first of the following
that can accommodate its value: unsigned short, unsigned int,
unsigned long int.
- If a constant has the L suffix, its data type will be the first of the following
that can accommodate its value: long int, unsigned long int.
- If a constant has both L and U suffixes, (LU or UL), its data type will be
unsigned long int.
Decimal
Decimal constants from -2147483648 to 4294967295 are allowed. Constants
exceeding these bounds will produce an “Out of range” error. Decimal constants
must not use an initial zero. An integer constant that has an initial zero is interpret-
ed as an octal constant. Thus,
int i = 10; /* decimal 10 */
int i = 010; /* decimal 8 */
int i = 0; /* decimal 0 = octal 0 */
In the absence of any overriding suffixes, the data type of a decimal constant is
derived from its value, as shown below:
127
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroC PRO for AVR
CHAPTER 5