how do you convert ascii character code to a character, say like in a cout statement.
Printable View
how do you convert ascii character code to a character, say like in a cout statement.
cast it to a char
(char)<ascii code>
Of course this works only for 0-255 (or actually since it's signed it should be -128 to 127)
char should usually be an unsigned quantity, since a negative character code doesn't mean anything.
But it isn't always.
What do you mean by "converting an ASCII code to a character"? The computer makes no distinction between an ASCII code and the appropriate character. It's all about how you output it.