English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C library function toupper() usage and example
C toupper() function prototype
int toupper(int arg);
The toupper() function accepts a single parameter in integer form and returns an int type value.
Even if toupper() uses an integer as a parameter, the character is still passed to the function. Internally, the character is converted to the corresponding ASCII value for checking.
If the parameter passed is not a lowercase letter, it returns the same character passed to the function.It<ctype.h>
Example: C toupper() function #include <stdio.h> #include <ctype.h> int main() { char c; c = 'm'; -> %c", c, toupper(c)); //If the character passed to toupper() is not a lowercase character, it displays the same parameter passed. c = 'D'; printf("\n%c -> %c", c, toupper(c)); c = '9'; printf("\n%c -> %c", c, toupper(c)); return 0; }
Output Result
m -> M D -> D 9 -> 9