C Library Functions -tolower()

C Standard Library - <ctype.h>

Description

C Library Functionsint tolower(int c)Convert the given letter to lowercase.

Declaration

Below is the declaration of the tolower() function.

int tolower(int c);

Parameter

  • c-- This is the letter to be converted to lowercase.

Return Value

If c has a corresponding lowercase letter, the function returns the lowercase of c; otherwise, c remains unchanged. The return value is an int value that can be implicitly converted to type char.

Example

The following example demonstrates the usage of the tolower() function.

Example

#include <stdio.h> #include <ctype.h> int main() { int i = 0; char c; char str[] = "EXAMPLE"; while( str[i] ) { putchar(tolower(str[i])); i++; } return(0); }

Let us compile and run the above program, which will produce the following results:

example

C Standard Library - <ctype.h>

other extensions