Latest web development tutorials

C library functions - tolower ()

C standard library - <ctype.h> C standard library - <ctype.h>

description

C library functionsint tolower (int c) the given letters to lowercase letters.

statement

Here is () statement tolower function.

int tolower(int c);

parameter

  • c - which it is to be converted to lowercase letters.

return value

C If there is the corresponding lowercase letters, then the function returns a lowercase c, c otherwise remains unchanged. The return value is a formula that can be implicitly converted to int type char.

Examples

The following example demonstrates tolower () function is used.

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

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

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

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

w3cschool tutorials

C standard library - <ctype.h> C standard library - <ctype.h>