What is isalpha in c programming?
isalpha in c checks the passed character is alphabetic or not.
We can use this function by including ctype.h header file.
This function returns non-zero digit if passed character is alphabet otherwise zero.
Prototype
int isalpha(int a);
Parmeter
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 alphabet otherwise zero.
Example program for isalpha in c
#include<stdio.h>
#include<ctype.h>
int main()
{
char x;
printf("Enter the character \n");
scanf("%c",&x);
if(isalpha(x))
printf("This is an alphabet \n");
else
printf("This is not an alphabet \n");
return 0;
}
Code explanation
isalpha function is called to determine whether the given input value is an alphabet or not. The result is printed on to the console.
Difference between isalpha and isalnum in c
isalpha function checks the passed parameter is alphabet or not. isalnum function checks the input parameter is alphanumeric or not.
Prototypes are as follows
int isalpha(int a);
int isalnum(int a);
isalpha in c | isalnum in c |
Checks the passed parameter is alphabet or not. | Checks the input parameter is alphanumeric or not. |
int isalpha(int a); | int isalnum(int a); |
People also ask for
What is isalpha in c?
isalpha function checks the passed character is alphabetic or not. This function is defined in ctype.h header file.