What is iswalnum() in C?
The iswalnum() function checks whether or not the given wide character is an
Library
#include <wctype.h>
Syntax
The function prototype is as follows:
int iswalnum(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
chis a letter or a digit. - If the integer returned is zero (false), it means
chis not a letter or a digit.
Code
#include <stdio.h>#include <stddef.h>#include <wctype.h>#include <wchar.h>int main (){int i=0;wchar_t str[] = L"Earth_123!";while (str[i]){if (iswalnum(str[i])) //if a letter or a digit, non-zero(true) value is returnedwprintf (L"%lc is an alphanumeric character\n", str[i]);else //not a letter and not a digitwprintf (L"%lc is not an alphanumeric character\n", str[i]);i++;}return 0;}
Free Resources
Copyright ©2025 Educative, Inc. All rights reserved