C Programming/wctype.h/iswupper

From Wikibooks, open books for an open world
Jump to navigation Jump to search


iswupper


The iswupper() function which stands for is wide character an upper case is a standard C library function in C language.
It is a wide character equivalent of the isupper() function. It checks whether wc, a wide character belongs to upper class or not.This function is used to check if entered wide character is upper case or not. A main difference between iswupper and isupper is that isupper returns nonzero value only if entered character is in the set (A to Z), but an additional concept in iswupper is, it returns non zero value only when entered character is in between(A to Z) and it is a wide character.It is included under a header file wctype.h.

Syntax

int iswupper (wint_t  wc);

The iswupper function returns a non-zero value if character entered is in upper case and belongs to the wide character class called "upper".Else it returns a zero.

Example <Source lang="c">

  1. include<stdio.h>
  2. include<ctype.h>

int main () { char a; int b; scanf ("%c", &a); b = iswupper(a);

       return 0;

} </syntaxhighlight> The above code shows us how this function can be used.Thus if entered value is wide character and of upper case and do not contain any symbols, it returns a non zero value.Else it returns a zero.