Why?
-
int j; j=4; //100 printf("\n\nj value:%d",(~j));//100-->(NOT)-->011-->So shouldn't this be 2?? It prints -5??? Why?:confused:
---------------------------- 286? WOWW!:-O
-
int j; j=4; //100 printf("\n\nj value:%d",(~j));//100-->(NOT)-->011-->So shouldn't this be 2?? It prints -5??? Why?:confused:
---------------------------- 286? WOWW!:-O
_8086 wrote:
011-->So shouldn't this be 2
Actually that's 3 :) The ~ operator effects ALL the bits of the integer
int j; // j is a signed integer - I'll assume 32-bits in length
j=4; // 00000000000000000000000000000100 (4)
j=~j; // 11111111111111111111111111111011 (-5)"If you can dodge a wrench, you can dodge a ball."
-
int j; j=4; //100 printf("\n\nj value:%d",(~j));//100-->(NOT)-->011-->So shouldn't this be 2?? It prints -5??? Why?:confused:
---------------------------- 286? WOWW!:-O
-
_8086 wrote:
011-->So shouldn't this be 2
Actually that's 3 :) The ~ operator effects ALL the bits of the integer
int j; // j is a signed integer - I'll assume 32-bits in length
j=4; // 00000000000000000000000000000100 (4)
j=~j; // 11111111111111111111111111111011 (-5)"If you can dodge a wrench, you can dodge a ball."