Convert a character to an uppercase alphabetical character.
Include
<ctype.h>
Prototype
int toupper (int c);
Argument
c
Return Value
Returns the corresponding uppercase alphabetical character if the argument,
c
, was originally lowercase; otherwise, returns the original
character.
Remarks
Only lowercase alphabetical characters may be converted to uppercase.
Example
#include <ctype.h>
#include <stdio.h>
int main(void)
{
int ch;
ch = 'b';
printf("b changes to uppercase %c\n",
toupper(ch));
ch = 'B';
printf("B remains uppercase %c\n",
toupper(ch));
ch = '@';
printf("@ has no uppercase, ");
printf("so %c is returned\n", toupper(ch));
}
Example Output
b changes to uppercase B
B remains uppercase B
@ has no uppercase, so @ is returned