Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - A strange question about unsigned integer conversion (please come in)
A strange question about unsigned integer conversion (please come in)
Well, the highest bit of int is the sign bit, and the highest bit of unsigned int is the valid bit. In printf, the result is converted to int because %d is used. But in A+B >; When comparing 6, A is unsigned first, and the result is converted into unsigned int. The highest bit of B is 1, which is equivalent to adding a (1

If you don't understand, you can

printf("a+b=%u\n ",(a+b));

Look at the results.