Campbell Ritchie wrote:Nothing wrong with that. You are printing '1' against '0' and '1' is 0x31. So it prints "49". Absolutely correct. Exactly the same value as the Unicode value for '1'.
Remember the Unicode website shows the numbers in hex and you are printing them in decimal. Try this printing instruction:And the reason for using code tags is that you are quoting your output and the checking for the letter U is disabled inside code tags.
So it's hex, converted to base-10, interesting notation, which has something to do with the way computers store binary digits in registers that are in multiples of 8 (e.g. 16, 32, 64 bit).
Whilst helpful, I couldn't quite figure out the printf line, since the compiler does not like compiling a cast to a (char) value, and, I couldn't quite understand the first parameter, it's not documented in my
book (p.67-68).