C puzzle: ~us

Harbison at TL-20A.ARPA Harbison at TL-20A.ARPA
Sun Dec 9 23:23:10 AEST 1984


What should the following program print, assuming "short" is implemented in
16 bits and "int" in 32 bits, using standard two's complement representation?

main(){
  unsigned short x = 0xfffe;
  printf("%8x\n", ~x)
}

Hint: Your choices are "1" or "ffff0001".
-------



More information about the Comp.unix.wizards mailing list