C examples for ctype.h:isalnum
function
<cctype> <ctype.h>
Checks whether c is either a digit.
int isalnum ( int c );
Parameter | Description |
---|---|
c | Character to be checked, casted as an int, or EOF. |
A non-zero value if indeed c is either a digit or a letter. Zero (i.e., false) otherwise.
#include <stdio.h> #include <ctype.h> int main ()/* w ww .j a va2 s . c om*/ { int i; char str[]="test a3o test 2s..."; i=0; while (isalnum(str[i])) i++; printf ("The first %d characters are alphanumeric.\n",i); return 0; }