English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

Usage and examples of the C library function tolower()

C Standard Library <ctype.h>

The tolower() function converts uppercase letters to lowercase characters.

If the parameter passed to the tolower() function is not an uppercase letter, it returns the same character passed to the function.

It isctype.h  Defined in header files.

Function prototype of tolower()

int tolower(int argument);

In C programming, characters are stored as integers. When a character is passed as a parameter, the corresponding ASCII value (integer) of the character is passed, rather than the character itself.

Example: How does the tolower() function work?

#include <stdio.h>
#include <ctype.h>
int main()
{
    char c, result;
    c = 'M';
    result = tolower(c);
    printf("tolower(%c) = %c\n", c, result);
    c = 'm';
    result = tolower(c);
    printf("tolower(%c) = %c\n", c, result);
    c = '';+';
    result = tolower(c);
    printf("tolower(%c) = %c\n", c, result);
    return 0;
}

Output Result

tolower(M) = m
tolower(m) = m
tolower(+) = +

C Standard Library <ctype.h>