C Standard Library

C <wctype.h> - iswupper() Function



The C <wctype.h> iswupper() function is used to check if the given wide character is an uppercase letter. In the default "C" locale, the following are the uppercase letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ. Other locales may consider a different selection of wide characters as uppercase letters.

Syntax

int iswupper ( wint_t ch );   

Parameters

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 a uppercase letter, else returns zero (i.e, false).

Example:

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

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

  //counting the number of uppercase
  //wide characters in str
  int i = 0, count = 0;
  while(str[i]) {
    if(iswupper(str[i]))
      count++;
    i++;
  }

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

The output of the above code will be:

99HEllo contains 2 uppercase letters.

❮ C <wctype.h> Library