C Standard Library

C <wctype.h> - iswalpha() Function

The C <wctype.h> iswalpha() function is used to check if the given wide character is an alphabetic letter. In the default "C" locale, an alphabetic letter is a letter for which either iswupper() or iswlower() function returns true. Other locales may consider a different selection of wide characters as alphabetic letters.


int iswalpha ( wint_t ch );               


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

Return Value

Returns non-zero value (i.e, true) if ch is an alphabetic letter, else returns zero (i.e, false).


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

#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
int main (){
  wchar_t str[50] = L"98Hi@@";

  //counting the numbers of 
  //alphabetic letters in str
  int i = 0, count = 0;
  while(str[i]) {

  //displaying the output
  printf("%ls contains %d alphabetic letters.", str, count);  
  return 0;

The output of the above code will be:

98Hi@@ contains 2 alphabetic letters.

❮ C <wctype.h> Library