Include <ctype.h> when character classes matter more than a particular encoding. Its classifiers—such as isalpha, isdigit, isspace, isalnum, and isxdigit—test characters, while toupper and tolower convert alphabetic case. For historical reasons, these interfaces accept and return int, not char. section 8.4
Classify, normalize, then convert
A base-36 digit converter can first test isdigit(a), subtract '0' for decimal digits, then apply toupper(a) and use isupper(a) before subtracting 'A'. toupper leaves nonalphabetic characters unchanged. The implementation relies on consecutive decimal digits and uppercase or lowercase letters, so it explicitly checks the relevant assumptions.

