Format
#include <ctype.h> int tolower(int C); int toupper(int c);
Language Level: ANSI
Threadsafe: Yes.
Description
The tolower() function converts the uppercase letter C to the corresponding lowercase letter.
The toupper() function converts the lowercase letter c to the corresponding uppercase letter.
Return Value
Both functions return the converted character. If the character c does not have a corresponding lowercase or uppercase character, the functions return c unchanged.
Example that uses toupper() and tolower()
This example uses the toupper() and tolower() functions to change characters between code 0 and code 7f.
#include <stdio.h> #include <ctype.h> int main(void) { int ch; for (ch = 0; ch <= 0x7f; ch++) { printf("toupper=%#04x\n", toupper(ch)); printf("tolower=%#04x\n", tolower(ch)); putchar('\n'); } }
Related Information
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.