Toupper c – toupper C Library Function

toupper() function converts a lowercase character to uppercase character, if such value exists for input character. If no such conversion is possible, it returns same character unchanged.

Function prototype of toupper

int toupper(int c);

Function toupper takes a character as input in form of an integer. When we pass a value of type char to toupper function, corresponding ASCII value of that character is passed.

Return value of toupper

Toupper c: Function toupper returns uppercase equivalent to c, if such value exists, or c (unchanged) otherwise.

C program using toupper function

C.toupper: The following program does lowercase to uppercase alphabet conversion using toupper function.

toupper C Library Function

#include <stdio.h>
#include <ctype.h>
#include <conio.h>
 
int main(){
    char string[] = "BTechgeeks.com";
    int index = 0;
     
    while(string[index] != '\0'){
        printf("%c", toupper(string[index]));
        index++;
    }
     
    getch();
    return 0;
}

Output

BTechgeeks.com