C Library Function - toupper()
Description
C Library Function int toupper(int c) Converts a lowercase letter to uppercase.
Declaration
Below is the declaration of the toupper() function.
int toupper(int c);
Parameters
- c -- This is the letter to be converted to uppercase.
Return Value
If c has a corresponding uppercase letter, the function returns the uppercase letter of c; otherwise c remains unchanged. The return value is an int value that can be implicitly converted to type char.
Example
The following example demonstrates the use of the toupper() function.
#include
#include
int main()
{
int i = 0;
char c;
char str[] = "runoob";
while(str[i])
{
putchar (toupper(str[i]));
i++;
}
return(0);
}
Let's compile and run the above program, which will produce the following result:
RUNOOB
C Standard Library -