Convert a character to uppercase
#include <ctype.h> int toupper( int c );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The toupper() function converts c to a uppercase letter, if c represents a lowercase letter.
The corresponding uppercase letter when the argument is a lowercase letter; otherwise, the original character is returned.
#include <stdio.h> #include <stdlib.h> #include <ctype.h> char chars[] = { 'a', '5', '$', 'z' }; #define SIZE sizeof( chars ) / sizeof( char ) int main( void ) { int i; for( i = 0; i < SIZE; i++ ) { printf( "%c ", toupper( chars[ i ] ) ); } printf( "\n" ); return EXIT_SUCCESS; }
produces the output:
A 5 $ Z
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |
isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), strlwr(), strupr(), tolower()