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?