Originally Posted by
matsp
If you enter 10 (decimal) to a input operator, it will (unless you have specified otherwise) take it as a decimal number. It will be stored as 000...01010 internally in the computer. If you then print that using oct, it will come out in octal. The octal representation of 00...001010 is 12. So, the number stored in the integer is exactly the same whether you entered 0x0a, 012 or 10 [assuming the machine understands that 0x.. is hex, and 0... is octal, and not starting with 0 is decimal].
Integers, no matter how they got into the computer, are stored as binary. You can choose, when you output them and when you input them, given the right input and output methods, to DISPLAY the number in different bases. But it doesn't really change the internal value of the number.
To explain it a different way: We have a piece of wood, that happens to be two meters long. Now, we can express that as 2000 mm, 200 cm or 2m. Or as 6'6" or 78". But it's still the same piece of wood, whichever unit we describe it's length with. The same applies to displaying numbers in computers - we can use "any unit", but the actual number is the same either way.
--
Mats