For example:
int main(){
int x = 01234567;
printf(\"\\n%d\\n\",x);
return 0;
}
The following code produces: 342391
At compile time a C compiler will identify any integer literals in your code and then interpret these via a set of rules to get their binary value for use by your program:
int x = 0x22
gives x
the decimal value of 2 * 16^1 + 2 * 16^0 = 34
.int x = 022
gives x
the decimal value of 2 * 8^1 + 2 * 8^0 = 18
.int x = 22
gives x
the decimal value of 22
.It should be noted that GCC supports an extension which provides another rule for specifying integers in binary format. Additionally, these methods of specification are only supported for integer literals at compile time.