Latest web development tutorials

C library functions - isupper ()

C standard library - <ctype.h> C standard library - <ctype.h>

description

Whether the C library functionint isupper (int c) Check the transmission characters are uppercase.

statement

Here is () statement isupper function.

int isupper(int c);

parameter

  • c - This was a test of character.

return value

If c is an uppercase letter, the function returns a nonzero value (true), otherwise it returns 0 (false).

Examples

The following example demonstrates isupper () function is used.

#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's compile and run the above program, which will result in the following:

var1 = |M| 是大写字母
var2 = |m| 不是大写字母
var3 = |3| 不是大写字母

C standard library - <ctype.h> C standard library - <ctype.h>