C examples for ctype.h:isalpha
function
<cctype> <ctype.h>
Check if character is alphabetic
int isalpha ( int c );
Parameter | Description |
---|---|
c | Character to be checked, casted to an int, or EOF. |
A non zero value (i.e., true) if c is an alphabetic letter. Zero (i.e., false) otherwise.
#include <stdio.h> #include <ctype.h> int main ()/* w ww.j a v a 2s.c om*/ { int i=0; char str[]="test C 123 *(&*%*^&%*^&"; while (str[i]) { if (isalpha(str[i])) printf ("character %c is alphabetic\n",str[i]); else printf ("character %c is not alphabetic\n",str[i]); i++; } return 0; }