Why is C++ behaving weirdly when I add leading 0's to an int? -


why

cout << 0110 << endl; 

printing out 72?

i didnt' think adding leading 0's int make difference, shouldn't '0110' same '110'?

note 0110 octal-literal:

octal-literal digit 0 (0) followed 0 or more octal digits (0, 1, 2, 3, 4, 5, 6, 7)

that's why you're getting 72 when printing out it, it's not same 110.


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -