toupper : <ctype.h> 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

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

C program to show the use of toupper function

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

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

int main(){
    char string[] = "";
    int index = 0;
    while(string[index] != '\0'){
        printf("%c", toupper(string[index]));
    return 0;

Program Output