Explain the use of function toupper() with an example code?
Shathana. S.R. Answered question May 26, 2023
The toupper() function “converts the lowercase letter c to the corresponding uppercase letter”. Both functions return the converted character. If the character c does not have a corresponding lowercase or uppercase character, the functions return c unchanged.
Shathana. S.R. Answered question May 26, 2023

Toupper() function is used to convert the value to uppercase when it used with characters.
Code:
#include
#include
int main()
{
char c;
c = ‘a’;
printf(“%c -> %c”, c, toupper(c));
c = ‘A’;
printf(“n%c -> %c”, c, toupper(c));
c = ‘9’;
printf(“n%c -> %c”, c, toupper(c));
return 0;
}