Q:

Bitwise Operators in C, int 021 vs 21?

I have a C programming exam a few days later, in the sample that I was given, there is a problem about bitwise operators. Now I know &, |, ^, <<, >> and what they do.
But I am kind of confused about this:
int main()
{
int i = 021, j = 0x2A, k,l,m;
k = i | j;
l = i & j;
m = k ^ l;

printf("%d, %d, %d, %d, %d\n",i,j,k,l,m);

return 0;
}

When I test it, the output is:
17 42 59 0 59
But I don't understand how. What is 021 in binary? 
If I take it as 21, (if I delete the 0 before it, the output changes completely.)
Can anyone help please?

A:

What is 021 in binary? If I take it as 21, (if I delete the 0 before it, the output changes completely.)

An integer literal beginning with 0 is an octal number. If you remove the 0, it is a decimal number. So the value of 021 is 2 * 8 + 1 which is 17. The binary representation is 10001. 
If 0 is removed, the value of i is 21 and the binary representation is 10101.
So the output changes accordingly when used in different operations.
Since you are using the conversion specifier d in your printf statement, all the values printed will be decimal.

