I know I was aiming a pointer to int at a char. But I DID use reinterpret_cast<>.
I mean, shouldnt reinterpret_cast<> "cast" pt into a pointer to a char????
I mean, shouldnt reinterpret_cast<> "cast" pt into a pointer to a char????
No. &chalready is a pointer to a char. You're casting it to a pointer to an int.
Line 9 ends up taking the data at 'ch' (As well as some data after it because ints are larger than chars -- of which the results are undefined) and interprets that data as if it were an integer.
Which is why you're getting a crazy garbage number instead of a character.
EDIT:
I reread what you said...
reinterpret_cast doesn't change 'pt', it changes what's in the parenthesis (in this case '&ch')
pt is still an int*. What you're doing is changing &ch from char* to int*