I have this code which converts a string to an int
unsigned int formatInt(char *ptr) {
int res;
if (sscanf(ptr, "%i", &res) == -1) exit(-1);
return res;
}
I fed it a char * pointing to the first char of "00000000041".
Conversion to int returns me 33 (Implicit Octal to Decimal conversion)
"00000000041" is actually a string (char[12]), but it's the size of a file in octal.
How did the compiler know it was in octal ? 00000000041 could perfectly be a decimal (41)