isupper() function in C Language

CProgrammingServer Side Programming

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\n");
   else
   printf("The character is not uppercase\n");
   if(isupper(val2))
   printf("The character is uppercase\n");
   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\n");
else
printf("The character is not uppercase\n");
raja
Published on 05-Nov-2018 11:04:29
Advertisements