I can't get it to work in CodeBlocks What will this code print? :
printf( "%hu" , ‐1 );
I can't get it to work in CodeBlocks What will this code print? :
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.