isalnum - C ctype.h

C examples for ctype.h:isalnum

Type

function

From

<cctype>
<ctype.h>

Description

Checks whether c is either a digit.

Prototype

int isalnum ( int c );

Parameters

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

Return Value

A non-zero value if indeed c is either a digit or a letter. Zero (i.e., false) otherwise.

Demo Code


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

Related Tutorials