The iswalnum()
function checks whether or not the given wide character is an
#include <wctype.h>
The function prototype is as follows:
int iswalnum(wint_t ch);
ch
: wide character to be checked.
The function returns an integer value:
ch
is a letter or a digit.ch
is not a letter or a digit.#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