I have a very simple C Program consisting of the following function:
int digit(int num)
{
return num/(10*10*10);
}
calling digit(2345) gives back 2 - as expected.
However, if I write the function in the following way (which - in my opinion - is equivalent!!):
int digit2(int num)
{
return num/(10^3);
}
and then call digit2(2345), this gives back 260 !!! ... This seems totally crazy to me !!! I used the following parameters for compilation in each case: gcc -std=c99 -Wall -Wextra -Wpedantic -Werror
What the hell is going on here???!!!!!