Reply to post: Re: Octal problem

Heard the one where the boss calls in an Oracle consultant who couldn't fix the database?

BinkyTheMagicPaperclip Silver badge

Re: Octal problem

Conall: No, << redirects the value to an output which in this case is stdout (std::cout)

A leading zero in C/C++ means 'Octal'. Therefore the first number (001) is in Octal, but it doesn't matter because under all number bases it still outputs 1. The second number is in Octal (010), and as base 8 runs with digits 0-7 per digit position, it evaluates to decimal 8. The third number (100) has no leading zero, so it's decimal and outputs as 100.

Therefore 18100

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon