Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C |
both |
#include <ctype.h>
int tolower(int c); /* Convert c to lowercase if appropriate */
int toupper(int c); /* Convert c to uppercase if appropriate */
Converts c to a lowercase letter, if possible. Conversely, the toupper() function converts c to an uppercase letter, if possible.
The DBCS is not supported. The use of characters from the DBCS results in unspecified behavior.
If successful, tolower() and toupper() return the corresponding character, as defined in the LC_CTYPE category of the current locale, if such a character exists.
If unsuccessful, tolower() and toupper() return the unchanged value c.
⁄* CELEBT15
This example demonstrates the result of using
&toupper. and &tolower. on a lower-case a.
*⁄
#include <stdio.h>
#include <ctype.h>
int main(void)
{
int ch;
ch = 0x81;
printf("toupper=%#04x\n", toupper(ch));
printf("tolower=%#04x\n", tolower(ch));
}