Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c

What is iswupper() in C?

Khizar Hayat Saani

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

iswupper() is a built-in function defined in the <wctype> header in C.

The function checks whether or not the given wide character is an uppercase letter. This check is specific to the current locale being used.

Syntax

The function prototype:

int iswupper(std::wint_t ch);

iswupper() returns non-zero if the input wide character is in uppercase. Otherwise, the function returns zero.

Wide characters

A wide character has a size greater than the traditional 8-bit character.

A wide string literal is prefixed by L.

The iswupper() function

Code

/* iswlower example */
#include <stdio.h>
#include <stddef.h>
#include <wctype.h>
int main ()
{
int i=0;
//wide string literal -- all UPPERCASE
wchar_t str[] = L"HeLlO WoRlD!";
//wide char for input
wchar_t c;
//loop to iterate over each char in str
while (str[i])
{
c = str[i];
if (iswupper(c))
printf("%c --> UPPERCASE\n", c);
else
printf("%c --> not uppercase\n", c);
i++;
}
return 0;
}

RELATED TAGS

c

CONTRIBUTOR

Khizar Hayat Saani
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring