How do you explain that line 7 gets a warning, but not line 5 or line 6?
int main()
{
unsigned char a = 0xFF;
unsig
I think the problem is that you convert int
to unsigned char
, AND back to int
.
Line 6 converts int
to unsigned char
, but just stores it into unsigned char
.
Line 7 converts int
to unsigned char
, and then, in order to do arithmetic, converts it back to int
. The new integer may be different from the original, so you get a warning.