
- The C Standard Library
- C Library - Home
- C Library - <assert.h>
- C Library - <ctype.h>
- C Library - <errno.h>
- C Library - <float.h>
- C Library - <limits.h>
- C Library - <locale.h>
- C Library - <math.h>
- C Library - <setjmp.h>
- C Library - <signal.h>
- C Library - <stdarg.h>
- C Library - <stddef.h>
- C Library - <stdio.h>
- C Library - <stdlib.h>
- C Library - <string.h>
- C Library - <time.h>
- C Standard Library Resources
- C Library - Quick Guide
- C Library - Useful Resources
- C Library - Discussion
- C Programming Resources
- C Programming - Tutorial
- C - Useful Resources
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C library function - isalpha()
Description
The C library function int isalpha(int c) checks if the passed character is alphabetic.
Declaration
Following is the declaration for isalpha() function.
int isalpha(int c);
Parameters
c − This is the character to be checked.
Return Value
This function returns non-zero value if c is an alphabet, else it returns 0.
Example
The following example shows the usage of isalpha() function.
#include <stdio.h> #include <ctype.h> int main () { int var1 = 'd'; int var2 = '2'; int var3 = '\t'; int var4 = ' '; if( isalpha(var1) ) { printf("var1 = |%c| is an alphabet\n", var1 ); } else { printf("var1 = |%c| is not an alphabet\n", var1 ); } if( isalpha(var2) ) { printf("var2 = |%c| is an alphabet\n", var2 ); } else { printf("var2 = |%c| is not an alphabet\n", var2 ); } if( isalpha(var3) ) { printf("var3 = |%c| is an alphabet\n", var3 ); } else { printf("var3 = |%c| is not an alphabet\n", var3 ); } if( isalpha(var4) ) { printf("var4 = |%c| is an alphabet\n", var4 ); } else { printf("var4 = |%c| is not an alphabet\n", var4 ); } return(0); }
Let us compile and run the above program, to produce the following result −
var1 = |d| is an alphabet var2 = |2| is not an alphabet var3 = | | is not an alphabet var4 = | | is not an alphabet
ctype_h.htm
Advertisements