C library function - tolower()


Advertisements


Description

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

Declaration

Following is the declaration for tolower() function.

int tolower(int c);

Parameters

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

Return Value

This function returns lowercase equivalent to c, if such value exists, else c remains unchanged. The value is returned as an int value that can be implicitly casted to char.

Example

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

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

int main()
{
   int i = 0;
   char c;
   char str[] = "TUTORIALS POINT";
	
   while( str[i] ) 
   {
      putchar(tolower(str[i]));
      i++;
   }
   
   return(0);
}

Let us compile and run the above program to produce the following result −

tutorials point

ctype_h.htm

Advertisements