Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C++ data short integer is always output with long integer-13 108.
C++ data short integer is always output with long integer-13 108.
For example.

char a = 0x 1FF;

int b = a;

Because the assignment overflowed, at this time a = 0xFF, because a is a signed char, according to the complement, the value of a is-1.

So when b = a,-1 is assigned to B.

If a is an unsigned integer. At this point, b is equal to 255.

If a has no overflow, it is judged to be positive according to the complement, and the value of b is the same as that of a.

take for example

char a = 0x 10F;

int b = a;