C Library Functions -isupper()
C Standard Library - <ctype.h>
Description
C Library Functionsint isupper(int c)Checks whether the passed character is an uppercase letter.
Declaration
The following is the declaration of the isupper() function.
int isupper(int c);
Parameter
- c-- This is the character to be checked.
Return Value
If c is an uppercase letter, the function returns a non-zero value (true); otherwise, it returns 0 (false).
Example
The following example demonstrates the usage of the isupper() function.
#include <stdio.h>
#include <ctype.h>
int main()
{
int var1 = 'M';
int var2 = 'm';
int var3 = '3';
if( isupper(var1) )
{
printf("var1 = |%c| 是大写字母\n", var1 );
}
else
{
printf("var1 = |%c| 不是大写字母\n", var1 );
}
if( isupper(var2) )
{
printf("var2 = |%c| 是大写字母\n", var2 );
}
else
{
printf("var2 = |%c| 不是大写字母\n", var2 );
}
if( isupper(var3) )
{
printf("var3 = |%c| 是大写字母\n", var3 );
}
else
{
printf("var3 = |%c| 不是大写字母\n", var3 );
}
return(0);
}
Let us compile and run the above program, which will produce the following results:
var1 = |M| 是大写字母 var2 = |m| 不是大写字母 var3 = |3| 不是大写字母other extensions