Thursday, February 25, 2021

, , ,

Example program for isalpha in c - Function In C

 The isalpha() function in  programming is used to check whether a character is an alphabet or not.

If a character is prove that it is an is an alphabet with the help of isalpha() function in c then it return non zero integer otherwise it gives zero. 

This function is define in the <ctype.h> header file in c.

C isalpha() Prototype

int isalpha(int argument);

isalpha() function in c takes a single argument in the form of integer and give an integer value.

Return Value For isalpha() in C

Return Value For isalpha()
Return Value For isalpha()


Example Program: C isalpha() function

#include <stdio.h>
#include <ctype.h>
int main()
{
    char c;
    c = 'Q';
    printf("\nResult when uppercase alphabet is passed: %d", isalpha(c));

    c = 'q';
    printf("\nResult when lowercase alphabet is passed: %d", isalpha(c));

    c='+';
    printf("\nResult when non-alphabetic character is passed: %d", isalpha(c));

    return 0;
}
OUTPUT : - 
Result when uppercase alphabet is passed: 1
Result when lowercase alphabet is passed: 2
Result when non-alphabetic character is passed: 0 
 

0 comments:

Post a Comment