+ 1
What is this output? Anyone can explain?
#include<stdio.h> int main( ){ unsigned int var=10; printf("%d", ~var); }
2 Respostas
+ 1
~ is not bitwise operator which invert the bits of the binary number
10 in binary is 00001010 when you invert it ir become 11110101 the last bit from the left is the sign which if 1 then negative if 0 then positive since it is 1 then it is -128 then the answer is - 128+64+32+16+4+1 =-11
Well ~var =-(var+1) always