int main()
{
int a=1,b;
b=~1;
printf(""%d",b);
return 0;
}
pls explain by showing bitwise operation it will be helpful to understand...
thanks in advance.......
int main()
{
int a=1,b;
b=~1;
printf(""%d",b);
return 0;
}
pls explain by showing bitwise operation it will be helpful to understand...
thanks in advance.......
It's exactly what you might imagine.
1is00000001in binary (number of digits depend on size ofinton your platform).~1performs a bitwise-inversion, i.e.111111110. In two's complement (the most common system of binary arithmetic), this is equal to-2.