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.

0
Subscribe to my newsletter

Read articles from Muhammad Hassaan Shah directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Muhammad Hassaan Shah
Muhammad Hassaan Shah

Passionate about new technological trends and like to share practical tips and tutorials about C, C++, Python, MATLAB, STM32, Arduino, ESP32, and more …