|
Re: EasyC Assignment rules
The place where Microchip C diverges significantly from ANSI C is exactly what jonboy was asking about.
What you need to know is this: the compiler looks at the size of the operands when choosing the precision of the operator, and picks the smallest number of bits that will fit both operands. It doesn't care about the size of what you're storing the result in. If you're adding or multiplying two chars, the answer will be a char and overflow will be an issue. The typical workaround is to cast one of the operands as (int) in order to force the compiler to do 16-bit arithmetic instead of just 8.
|