isalpha - C ctype.h

C examples for ctype.h:isalpha

Type

function

From

<cctype> 
<ctype.h>

Description

Check if character is alphabetic

Prototype

int isalpha ( int c ); 
       

Parameters

Parameter Description
c Character to be checked, casted to an int, or EOF.

Return Value

A non zero value (i.e., true) if c is an alphabetic letter. Zero (i.e., false) otherwise.

Demo Code

#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;
}

Related Tutorials