The function prototype of the toupper()
function is:
int toupper(int ch);
toupper() Parameters
The function takes a single argument.
- ch - a character
Return value from toupper()
If an argument passed to toupper()
is
- a lowercase character, the function returns its corresponding uppercase character
- an uppercase character or a non-alphabetic character, the function the character itself
The toupper()
function is defined in the <ctype.h> header file.
Example: C toupper() function
#include <stdio.h>
#include <ctype.h>
int main() {
char c;
c = 'm';
printf("%c -> %c", c, toupper(c));
c = 'D';
printf("\n%c -> %c", c, toupper(c));
c = '9';
printf("\n%c -> %c", c, toupper(c));
return 0;
}
Output
m -> M D -> D 9 -> 9