------------------------------------------------------------------------------
MC logo
Character Operations
[^] Code Examples
------------------------------------------------------------------------------
<<Constant References Print the ASCII Set>>
Characters in C are really just small integers.
char ch;
scanf("%c", &ch); Read the next character
ch = getchar(); Read the next character (plain C)
cin.get(ch) Read the next character
scanf(" %c", &ch); Read the next non-blank character
cin >> ch Read the next non-blank character
printf("%c", ch); Print a character
putchar(ch); Print a character (plain C)
cout << ch Print a character
ch + 5 Arithmetic on chars is okay.
ch - 'a' + 'A' Change case
#include <ctype.h>
#include <cctype>
isalpha(ch)
isupper(ch)
. . .
toupper(ch)
toascii(ch)
<<Constant References Print the ASCII Set>>