C library function - isupper()
Description
C Library Function int isupper(int c) Checks whether the passed character is an uppercase letter.
Declaration
Here is the declaration of the isupper() function.
int isupper(int c);
Parameters
- c -- This is the character to be checked.
Return Value
If c is an uppercase letter, the function returns a nonzero value (true); otherwise it returns 0 (false).
Example
The following example demonstrates the use of the isupper() function.
#include
#include
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's compile and run the above program, which will produce the following result:
var1 = |M| 是大写字母
var2 = |m| 不是大写字母
var3 = |3| 不是大写字母
C Standard Library -