C programming ctype.h function - int tolower(int c)

The int tolower(int c) function in the ctype.h library of C programming is used to convert a given uppercase letter to its corresponding lowercase letter.

The tolower() function takes a single integer argument c, which is the character to be converted to lowercase. The function returns an integer value, which is the lowercase version of the input character c if it is an uppercase letter, and the same character c otherwise.

Here's an example of how to use the tolower() function in C:

#include <stdio.h>
#include <ctype.h>

int main() {
    char c = 'B';
    char lc = tolower(c);
    printf("The lowercase version of %c is %c\n", c, lc);
    return 0;
}
Source:w‮‬ww.theitroad.com

In this example, the tolower() function is used to convert the uppercase letter 'B' to its corresponding lowercase letter. The function returns the character 'b', which is then assigned to the variable lc. The output of the program will be: 'The lowercase version of B is b'.

If the input character had already been a lowercase letter such as 'f', the tolower() function would return the same character 'f', and the output would be: 'The lowercase version of f is f'.