For example:
int main(){
int x = 01234567;
printf("\n%d\n",x);
return 0;
}
The following code produces: 342391
If I didn't include the 0 at the beginning, the value x would be 1234567, why does C store the value this way and is there any way to get it from not doing this?
Because numbers starting with 0 are represented as octal numbers. You cannot really modify this behavior, simply do not include the zero at the beginning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With