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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -