I feel I'm missing something basic about number system but I'm really confused with below piece of code I'm trying to play with bitwise operators:
x=56;
printf("\nHere :\n%x %x\n",x,077);
x=x& ~077;
printf("%x\n",x);
It considers 077 as octal(hex 3f). And if I put only 77 it treats it as decimal (hex 4d). If put 177 , its treated as decimal(hex b1). I'm referring the book C programming by Richie and Kernighan.
Please help.
All exactly as expected. Start with a 0 and it's octal. Start with 0x and it's hex. Otherwise, it is decimal.
What is the problem?