C isupper()

C isupper() Prototype

int isupper(int argument);

Function isupper() takes a single argument in the form of an integer and returns a value of type int.

Even though, isupper() takes integer as an argument, character is passed to the function. Internally, the character is converted to its ASCII for the check.

It is defined in <ctype.h> header file.


C isupper() Return Value

Return Value Remarks
Non-zero integer ( x > 0 ) Argument is an uppercase alphabet.
Zero (0) Argument is not an uppercase alphabet.

Example: C isupper() function

#include <stdio.h>
#include <ctype.h>
int main()
{
    char c;

    c = 'C';
    printf("Return value when uppercase character %c is passed to isupper(): %d", c, isupper(c));

    c = '+';
    printf("\nReturn value when another character %c is passed to is isupper(): %d", c, isupper(c));

   return 0;
}

Output

Return value when uppercase character C is passed to isupper(): 1
Return value when another character + is passed to is isupper(): 0

Note: You may get different integer value when uppercase alphabet is passed to isupper() on your system. But, when you pass any character other than uppercase character to isupper(), it always returns 0.

Did you find this article helpful?