tolower() function in C

tolower() function in C

Using the tolower() function in C

The tolower() function in C is used to convert an uppercase character to its lowercase counterpart. For example, the tolower() the function would convert the character 'A' to 'a'.

The tolower() function takes a character as input and returns the converted character.

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

int32_t main(int32_t argc, char const *argv[])
{
    char c = 'A';
    char lower_c = tolower(c);
    printf("The lowercase version of '%c' is '%c'.\n", c, lower_c);

    return 0;
}

Converts uppercase letters to lowercase. Returns the lowercase equivalent to the letters, if such value exists, else letters remain unchanged. The character’s value must be representable as an unsigned char or the value of EOF.

Explore the complete list of functions available in ctype header in C standard library.