isalnum in c
isalnum in c programming

What is isalnum in c programming?

isalnum in c checks the input parameter is alphanumeric or not.

This function is defined in ctype.h header file.

This function returns non-zero digit if passed character is decimal value otherwise zero.

Prototype

int isalnum(int a);

Parameter

This function takes character as input parameter and converts it into ASCII value.

Return value

This function returns non-zero value if passed character is alphanumeric otherwise zero.


Example program for isalnum function in c

#include<stdio.h>
#include<ctype.h>
int main()
{
  int x='2';
  int b='\';
  printf("\n\n\tThe passed value is %d \n",isalnum(x));
  printf("\tThe passed value is %d \n",isalnum(b));
  return 0;
}
Example for isalnum in c programming

Code explanation

isalnum function is called to check whether the passed character is an alphanumeric character or not. The result is being printed onto the console.

isalnum() Man page


Difference between isalnum and isalpha in c

isalnum function checks the input parameter is alphanumeric or not. isalpha function checks the passed parameter is alphabet or not.

Prototypes are as follows

int isalnum(int a);

int isalpha(int a);
isalnumisalpha
Checks the input parameter is alphanumeric or not.Checks the passed parameter is alphabet or not.
int isalnum(int a);int isalpha(int c);

People also ask for

What is isalnum in c?

isalnum function checks the input parameter is alphanumeric or not. It is defined in ctype.h header file.