isupper() function in C Language



The function isupper() is used to check that the character is uppercase or not. It returns non-zero value if successful otherwise, return zero. It is declared in “ctype.h” header file.

Here is the syntax of isupper() in C language,

int isupper(int character);

Here,

character − The character which is to be checked.

Here is an example of isupper() in C language,

Example

 Live Demo

#include<stdio.h>
#include<ctype.h>
int main() {
   char val1 = 's';
   char val2 = 'S';
   if(isupper(val1))
   printf("The character is uppercase
");    else    printf("The character is not uppercase
");    if(isupper(val2))    printf("The character is uppercase
");    else    printf("The character is not uppercase");    return 0; }

Output

The character is not uppercase
The character is uppercase

In the above program, two variables val1 and val2 are initialized with random alphabets and by using isupper() function, these variables are checked that they are uppercase letter or not.

char val1 = 's';
char val2 = 'S';
if(isupper(val1))
printf("The character is uppercase
"); else printf("The character is not uppercase
");
Samual Sam
Samual Sam

Learning faster. Every day.


Advertisements