toupper function(Convert to Uppercase) in C Language – example and detail

In the C Programming Language, the toupper function returns c as an uppercase letter.


The syntax for the toupper characteristic in the C Language is:

int toupper(int c);

Parameters or Arguments


The value to convert to an uppercase letter.


The toupper characteristic returns c as an uppercase letter. If c is already uppercase, the toupper characteristic returns c unchanged.

Required Header

In the C Language, the required header for the toupper feature is:

#include <ctype.h>

Applies To

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

ANSI/ISO 9899-1990

toupper Example

Let’s look at an instance to see how you would use the toupper function in a C program:

/* Example using toupper by */

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

int main(int argc, const char * argv[])
    /* Define a variable and set it to 'b' */
    int letter = 'b';

    /* Display a lowercase 'b' */
    printf("Uppercase '%c' is '%c'\n", letter, toupper(letter));

    return 0;

When compiled and run, this application will output:

Uppercase 'b' is 'B'

Similar Functions

Other C functions that are similar to the toupper function:

islower characteristic isupper feature tolower characteristic

See Also

Other C features that are noteworthy when dealing with the toupper function:

isalpha function <ctype.h>