Test for an alphabetic character.
Include
<ctype.h>
Prototype
int isalpha(int c);
Argument
c
Return Value
Returns a non-zero integer value if the character is alphabetic; otherwise, returns zero.
Remarks
Alphabetic characters are included within the ranges A-Z or a-z.
Example
#include <ctype.h>
#include <stdio.h>
int main(void)
{
int ch;
ch = 'B';
if (isalpha(ch))
printf("B is alphabetic\n");
else
printf("B is NOT alphabetic\n");
ch = '#';
if (isalpha(ch))
printf("# is alphabetic\n");
else
printf("# is NOT alphabetic\n");
}
Example Output
B is alphabetic
# is NOT alphabetic