Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c

What is iswalpha() in C?

Syed Muhammad Ali Mustafa

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.

The iswalpha() function checks whether or not the wide character provided as the argument is an uppercase/lowercase letter.

Uppercase/Lowercase letters

Library

#include <wctype.h>

Syntax

The function prototype is as follows:

int iswalpha(wint_t ch);

ch: wide character to be checked.

Return Value

The function returns an integer value:

  • If the integer returned is non-zero (true), it means ch is a letter.
  • If the integer returned is zero (false), it means ch is not a letter.

Code

#include <stdio.h>
#include <wctype.h>
#include <wchar.h>
int main ()
{
int i=0;
wchar_t str[] = L"Educative_<3";
while (str[i])
{
if (iswalpha(str[i])) //if a letter, non-zero(true) value is returned
wprintf (L"%lc is a letter\n",str[i]);
else //not a letter
wprintf (L"%lc is not a letter\n",str[i]);
i++;
}
return 0;
}

RELATED TAGS

c

CONTRIBUTOR

Syed Muhammad Ali Mustafa
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