convert a character to lowercase
#include <ctype.h> int tolower( int c ); int _tolower( int c );
The tolower() function converts c to a lowercase letter if c represents an uppercase letter.
The _tolower() function is a version of tolower() to be used only when c is known to be uppercase.
The corresponding lowercase letter when the argument is an uppercase letter; otherwise, the original character is returned.
![]() |
The result of _tolower() is undefined if c isn't an uppercase letter. |
#include <stdio.h>
#include <ctype.h>
char chars[] = {
'A',
'5',
'$',
'Z'
};
#define SIZE sizeof( chars ) / sizeof( char )
void main()
{
int i;
for( i = 0; i < SIZE; i++ ) {
printf( "%c ", tolower( chars[ i ] ) );
}
printf( "\n" );
}
produces the output:
a 5 $ z
| Safety: | |
|---|---|
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), strlwr(), strupr(), toupper()