isupper function(Test for Uppercase Letter) in C Language – example and detail

In the C Programming Language, the isupper function assessments whether c is an uppercase letter.

Syntax

The syntax for the isupper feature in the C Language is:

int isupper(int c);

Parameters or Arguments

c The fee to take a look at whether or not it is an uppercase letter.

Returns

The isupper feature returns a nonzero price if c is an uppercase letter and returns zero if c is no longer an uppercase letter.

Required Header

In the C Language, the required header for the isupper characteristic is:

#include <ctype.h>

Applies To

In the C Language, the isupper characteristic can be used in the following versions:

ANSI/ISO 9899-1990

isupper Example

Let’s seem at an example to see how you would use the isupper feature in a C program:

/* Example using isupper by TechOnTheNet.com */

#include <stdio.h>
#include <ctype.h>

int main(int argc, const char * argv[])
{
    /* Define a variable to hold our test letter */
    int letter;

    /* Set the letter to a uppercase 'A' */
    letter = 'A';

    /* Test to see if the letter provided is uppercase */
    if (isupper(letter)) printf("'%c' is uppercase\n", letter);
    else printf("'%c' is lowercase\n", letter);

    /* Set the letter to a uppercase 'a' */
    letter = 'a';

    /* Test to see if the letter provided is uppercase */
    if (isupper(letter)) printf("'%c' is uppercase\n", letter);
    else printf("'%c' is lowercase\n", letter);

    return 0;
}

When compiled and run, this software will output:

'A' is uppercase
'a' is lowercase

Similar Functions

Other C functions that are comparable to the isupper function:

isalpha feature islower feature tolower function toupper feature

See Also

Other C functions that are noteworthy when dealing with the isupper function:

isalnum function <ctype.h>