tolower Function

Convert a character to a lowercase alphabetical character.

Include

<ctype.h>

Prototype

int tolower (int c);

Argument

c
The character to convert to lowercase.

Return Value

Returns the corresponding lowercase alphabetical character if the argument, c, was originally uppercase; otherwise, returns the original character.

Remarks

Only uppercase alphabetical characters may be converted to lowercase.

Example

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

int main(void)
{
  int ch;

  ch = 'B';
  printf("B changes to lowercase %c\n",
          tolower(ch));

  ch = 'b';
  printf("b remains lowercase %c\n",
          tolower(ch));

  ch = '@';
  printf("@ has no lowercase, ");
  printf("so %c is returned\n", tolower(ch));
}

Example Output

B changes to lowercase b
b remains lowercase b
@ has no lowercase, so @ is returned