[Previous]
[Contents]
[Next]

toupper(), _toupper()

convert a character to uppercase

Synopsis:

#include <ctype.h>

int toupper( int c );
int _toupper( int c );

Description:

The toupper() function converts c to an uppercase letter if c represents a lowercase letter.

The _toupper() function is a version of toupper() to be used only when c is known to be lowercase.

Returns:

The corresponding uppercase letter when the argument is a lowercase letter; otherwise, the original character is returned.


Note: The result of _toupper() is undefined if c isn't a lowercase letter.

Examples:

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

char chars[] = {
    'a',
    '5',
    '$',
    'z'
};

#define SIZE sizeof( chars ) / sizeof( char )

void main()
  {
    int   i;

    for( i = 0; i < SIZE; i++ ) {
    printf( "%c ", toupper( chars[ i ] ) );
    }
    printf( "\n" );
  }

produces the output:

A 5 $ Z

Classification:

toupper() is ANSI; _toupper() is WATCOM.
Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), strlwr(), strupr(), tolower()


[Previous]
[Contents]
[Next]