Wednesday, May 26, 2021

, , , , , ,

toupper() function in c with exmaple program

 toupper() function in c programming is used to convert lowercase alphabets to uppercase letters.

When a programmer passed a lowercase alphabet to toupper() function then it converts it to uppercase.

Or when a uppercase alphabet is passed then function returns same value.

Syntax for toupper() function in c :-

int toupper(int ch);

Example Program for toupper() in c :- 

Let's go with an simple s example program to convert lower case alphabet to uppercase using toupper() function.

#include <ctype.h> 

int main() 
    char ch; 

    // letter to convert to uppercase
    ch = 'a'; 

    printf("%c in uppercase is represented as %c", 
        ch, toupper(ch)); 

    return 0; 

Note :- Remember toupper() in c only takes one character at a time.

So if you want to convert a hole word then use while loop for it

1 comment:

  1. Great article by the great author, it is very massive and informative but still preaches the way to sounds like that it has some beautiful thoughts described so I really appreciate this article. Best learning mandarin service provider.