Include <ctype.h> to use toupper, which converts an alphabetic character to the corresponding case and leaves every other character unchanged. It accepts and returns int, reflecting C's treatment of integer character constants such as 'a'. section 8.4
Normalizing a hexadecimal digit
unsigned hexatridecimal(int a) { if (isdigit(a)) return a - '0'; a = toupper(a); return (isupper(a)) ? 10 + (a - 'A') : -1; } Here toupper makes lowercase alphabetic digits comparable with uppercase digits; non-Latin-uppercase results are rejected by the following test.
