K
karthikbalaguru
Hi,
I find that numbers beginning with a zero are evaluated in base 8.
Example -
int numbers[] = { 001,
010, // This is treated as 8 and
not as 10 Strange
};
I find that compiler does not complain and continues performing after
converting the octal to the corresponding decimal value .
Initially i was shocked , But later practised to it.
This option of '0' before a number to treat it as octal in C causes
problem sometimes(Easy path for error) .
Octal, we just have a 0 infront of the number in 'C' .
There should be someother convention ? What do you think ?
Thx,
Karthik Balaguru
I find that numbers beginning with a zero are evaluated in base 8.
Example -
int numbers[] = { 001,
010, // This is treated as 8 and
not as 10 Strange
};
I find that compiler does not complain and continues performing after
converting the octal to the corresponding decimal value .
Initially i was shocked , But later practised to it.
This option of '0' before a number to treat it as octal in C causes
problem sometimes(Easy path for error) .
Octal, we just have a 0 infront of the number in 'C' .
There should be someother convention ? What do you think ?
Thx,
Karthik Balaguru