Facebook Page Twitter Page LinkedIn Page
× C Standard Library


The C <wctype.h> towlower() function is used to convert the given wide character to lowercase, if it exists. If the lowercase version of the given wide character does not exist, it remains unchanged.

The following uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ are replaced with respective lowercase letters abcdefghijklmnopqrstuvwxyz.

Syntax

wint_t towlower ( wint_t ch );              

Parameters

ch Specify the wide character to be converted, casted to an wint_t, or WEOF.

Return Value

Returns lowercase version of ch or unchanged ch if no lowercase value is listed in the current C locale.

Example:

The below example shows the usage of towlower() function.

#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
 
int main (){
  wchar_t str[50] = L"HELLO World!";

  //converting str into lower case
  int i = 0;
  while(str[i]) {
    str[i] = towlower(str[i]);
    i++;
  }

  //displaying the output
  printf("%ls\n", str);  
  return 0;
}

The output of the above code will be:

hello world!

❮ C <wctype.h> Library