Syntax
#include <ctype.h> int tolower(int C); int toupper(int c);Description
tolower converts the uppercase letter C to the corresponding lowercase letter.
toupper converts the lowercase letter c to the corresponding uppercase letter.
The character mapping is determined by the LC_CTYPE category of the current locale.
Note: toupper and tolower can only be used for single-byte characters. towupper and towlower should be used for case conversion of wide characters that are equivalent to both single-byte and double-byte characters.
Both functions return the converted character. If the character c does not have a corresponding lowercase or uppercase character, the functions return c unchanged.
This example uses toupper and tolower to modify characters between code 0 and code 7f.
#include <stdio.h>
#include <ctype.h>
int main(void)
{
   int ch;
   /* print hex values of characters */
   for (ch = 0; ch <= 0x7f; ch++) {
      printf("toupper=%#04x\n", toupper(ch));
      printf("tolower=%#04x\n", tolower(ch));
      putchar('\n');
   }
   return 0;
}
Related Information