totn C Functions

C Language: isupper function
(Test for Uppercase Letter)

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

Syntax

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

int isupper(int c);

Parameters or Arguments

c
The value to test whether it is an uppercase letter.

Returns

The isupper function returns a nonzero value if c is an uppercase letter and returns zero if c is not an uppercase letter.

Required Header

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

#include <ctype.h>

Applies To

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

  • ANSI/ISO 9899-1990

isupper Example

Let's look at an example to see how you would use the isupper function 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 application will output:

'A' is uppercase
'a' is lowercase

Similar Functions

Other C functions that are similar to the isupper function:

See Also

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