Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - If the unsigned integer a=65535 is defined in C language, what system does it belong to? Why is a= 1 when outputting in %d format?
If the unsigned integer a=65535 is defined in C language, what system does it belong to? Why is a= 1 when outputting in %d format?
The answer on the first floor is wrong. The range of unsigned integers is 0-65535, not 0-65534. Unsigned integer takes up two bytes in C language, one byte is eight bits and the other two bytes are sixteen bits, and then it is expressed as 000000000000 ~111111.

Supplement: For signed integers, it also takes two bytes. The highest bit is the sign bit, that is, the leftmost bit. The highest bit is 1, which means negative number, and the highest bit is 0, which means positive number. Therefore, the range represented by signed integers is

-32768~32767, the explanation may be a little vague. You can check it yourself and understand it yourself.