C Language: tolower function
(Convert to Lowercase)
In the C Programming Language, the tolower function returns c as a lowercase letter.
Syntax
The syntax for the tolower function in the C Language is:
int tolower(int c);
Parameters or Arguments
- c
- The value to convert to a lowercase letter.
Returns
The tolower function returns c as a lowercase letter. If c is already lowercase, the tolower function returns c unchanged.
Required Header
In the C Language, the required header for the tolower function is:
#include <ctype.h>
Applies To
In the C Language, the tolower function can be used in the following versions:
- ANSI/ISO 9899-1990
tolower Example
Let's look at an example to see how you would use the tolower function in a C program:
/* Example using tolower by TechOnTheNet.com */ #include <stdio.h> #include <ctype.h> int main(int argc, const char * argv[]) { /* Define a variable and set it to 'A' */ int letter = 'A'; /* Display a lowercase 'A' */ printf("Lowercase '%c' is '%c'\n", letter, tolower(letter)); return 0; }
When compiled and run, this application will output:
Lowercase 'A' is 'a'
Similar Functions
Other C functions that are similar to the tolower function:
See Also
Other C functions that are noteworthy when dealing with the tolower function:
Advertisements