Typecasting in AVR-GCC

I am sure- typecasting is one of common practices in embedded C when converting one variable to another. As AVR microcontrollers are 8 bit systems and sometimes we operate with 16, 32 or even 64 bit length variables we have an ability to change like 16 bit integer value to 8 bit char and so on. This operations is so called typecasting. So it is important to understand this operation in order to use it properly and get desired result.

When you want to typecast a variable use parenthesis symbols "(" and " )" like in following example:

int X;

char C=30;

X=(int)C*10; //variable C is type-casted to int

Now X result is 300. Without typecasting compiler would think C as char and result would be 44(0x2C) as maximum value for char is 255.