Why does this code print 65535? :
printf( "%hu" , ‐1 );
It will print 65535
"%hu" is an unsigned short int which is 16 bit.
-1 is "all-ones", e.g. 0xffff.ffff, but since it gets converted to short it is only 0xffff. Which is 65535 as unsigned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With