C library functions -toupper()
C Standard Library - <ctype.h>
Description
C Library Functionsint toupper(int c)Convert lowercase letters to uppercase letters.
Declaration
Below is the declaration of the toupper() function.
int toupper(int c);
Parameter
- 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 usage of the toupper() function.
#include <stdio.h>
#include <ctype.h>
int main()
{
int i = 0;
char c;
char str[] = "example";
while(str[i])
{
putchar (toupper(str[i]));
i++;
}
return(0);
}
Let us compile and run the above program, which will produce the following result:
EXAMPLEother extensions