![The C Standard Library Reference](/c_standard_library/images/c-mini-logo.jpg)
- The C Standard Library
- C Library - Home
- C Library - <assert.h>
- C Library - <complex.h>
- C Library - <ctype.h>
- C Library - <errno.h>
- C Library - <fenv.h>
- C Library - <float.h>
- C Library - <inttypes.h>
- C Library - <iso646.h>
- C Library - <limits.h>
- C Library - <locale.h>
- C Library - <math.h>
- C Library - <setjmp.h>
- C Library - <signal.h>
- C Library - <stdalign.h>
- C Library - <stdarg.h>
- C Library - <stdbool.h>
- C Library - <stddef.h>
- C Library - <stdio.h>
- C Library - <stdlib.h>
- C Library - <string.h>
- C Library - <tgmath.h>
- C Library - <time.h>
- C Library - <wctype.h>
- C Standard Library Resources
- C Library - Quick Guide
- C Library - Useful Resources
- C Library - Discussion
- C Programming Resources
- C Programming - Tutorial
- C - Useful Resources
C library - iswlower() function
The C wctype library iswlower() function is used to check whether a given wide character (represented by wint_t) is a lowercase letter or not, i.e. one of "abcdefghijklmnopqrstuvwxyz" or any lowercase letter specific to the current locale.
This function can be useful for character validation, case conversion, string processing, or tokenization and parsing.
Syntax
Following is the C library syntax of iswlower() function −
int iswlower( wint_t ch )
Parameters
This function accepts a single parameter −
-
ch − It is a wide character of type 'wint_t' to be checked.
Return Value
This function returns Non-zero value if the wide character is a lowercase letter, zero otherwise.
Example 1
The following is the basic c example that demonstrate the use of iswlower() function.
#include <stdio.h> #include <wctype.h> #include <wchar.h> int main() { wchar_t wc = L'a'; if (iswlower(wc)) { wprintf(L"The character '%lc' is a lowercase letter.\n", wc); } else { wprintf(L"The character '%lc' is not a lowercase letter.\n", wc); } return 0; }
Output
Following is the output −
The character 'a' is a lowercase letter.
Example 2
In this example, we use iswlower() to print the all lowercase from the given wide character.
#include <stdio.h> #include <wctype.h> #include <wchar.h> int main() { wchar_t str[] = L"Hello, tutorialspoint India"; // Iterate over each character in the wide string for (int i = 0; str[i] != L'\0'; i++) { if (iswlower(str[i])) { wprintf(L"%lc ", str[i]); } } return 0; }
Output
Following is the output −
e l l o t u t o r i a l s p o i n t n d i a
Example 3
We create a c program to count the number of lowercase letter in the given wide character.
#include <stdio.h> #include <wctype.h> #include <wchar.h> int main() { wchar_t str[] = L"Hello, tutorialspoint India"; int lowercaseCount= 0; // Iterate over each character in the wide string for (int i = 0; str[i] != L'\0'; i++) { if (iswlower(str[i])) { lowercaseCount++; } } // Print the result wprintf(L"The wide string \"%ls\" contains %d lowercase letter(s).\n", str, lowercaseCount); return 0; }
Output
Following is the output −
The wide string "Hello, tutorialspoint India" contains 22 lowercase letter(s).