Hex Confusion....
I am very confused... To put it lightly
First i Will post a code fragment
[php]
char bit = '\x42';
char mi = 0x42;
char f = '0x42';
cout << bit << endl << mi << endl << f << endl;
[/php]
The output to this is
My question is why....
'\x42' is B, that makes sense, the hexadecimal ascii character code for B is 0x42, and \x is the escape sequence for hexadecimal values, thus '\x42' == 0x42
0x42 is Appearently B also. This kinda makes sense, with everything i said before, but apparently even without the ' ' it is recognized as a character
'0x42' is 2...... This is where i am completely confused, why in the world is '0x42' the integer 2?
From what i know '\x42' and 0x42 should be equivalent, which it is. The last one just confounds me thought
Thanks for your time. I'm sure i'm overlooking something.
Edit: After playing with it some more, it would seem that it could just be randomly Organized Nonsense. I'd still like a definitive answer though.