Easy Tutorial
❮ C Data Types C Function Fflush ❯

C Library Function - tolower()

C Standard Library - <ctype.h>

Description

The C library function int tolower(int c) converts the given letter to lowercase.

Declaration

Here is the declaration for the tolower() function.

int tolower(int c);

Parameters

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 that can be implicitly converted to char.

Example

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

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

int main()
{
   int i = 0;
   char c;
   char str[] = "TUTORIALPRO";

   while( str[i] ) 
   {
      putchar(tolower(str[i]));
      i++;
   }

   return(0);
}

Let's compile and run the above program, which will produce the following result:

tutorialpro

C Standard Library - <ctype.h>

❮ C Data Types C Function Fflush ❯