C isupper() library function

isupper() function checks whether a character is uppercase alphabet(A-Z) or not.

Function prototype of isupper

int isupper(int c);
Function isupper() takes a character as input in form of an integer. When we pass a value of type char to isupper() function, corresponding ASCII value of that character is passed.

Return value of isupper

If passed character is a uppercase character, then isupper function returns non-zero(true) integer otherwise 0(false).

C program using isupper function

The following program is to check whether a character is uppercase character or not.

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

int main(){
    char string[] = "Aa.1";
    int index = 0;
    
    while(string[index] != '\0'){
        if(isupper(string[index])){
            printf("'%c' is a uppercase character\n", string[index]);
        } else {
            printf("'%c' is not a uppercase character\n", string[index]);
        }
        index++;
    }
    
    return 0;
}

Output
'A' is a uppercase character
'a' is not a uppercase character
'.' is not a uppercase character
'1' is not a uppercase character