Datasheet
EXPLICIT TYPES CONVERSIONS (TYPECASTING)
In most situations, compiler will provide an automatic implicit conversion of types
where needed, without any user's interference. Also, the user can explicitly convert
an operand to another type using the prefix unary typecast operator:
(type) object
This will convert object to a specified type. Parentheses are mandatory.
For example:
/* Let's have two variables of char type: */
char a, b;
/* Following line will coerce a to unsigned int: */
(unsigned int) a;
/* Following line will coerce a to double,
then coerce b to double automatically,
resulting in double type value: */
(double) a + b; // equivalent to ((double) a) + b;
177
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroC PRO for AVR
CHAPTER 5