Latest web development tutorials

C library functions - toupper ()

C standard library - <ctype.h> C standard library - <ctype.h>

description

C library functionsint toupper (int c) of the lowercase letters converted to uppercase letters.

statement

Here is () statement toupper function.

int toupper(int c);

parameter

  • c - which is to be converted to uppercase letters.

return value

C If there is corresponding capital letters, then the function returns c capital letters, otherwise c remains unchanged. The return value is a formula that can be implicitly converted to int type char.

Examples

The following example demonstrates toupper () function is used.

#include <stdio.h>
#include <ctype.h>

int main()
{
   int i = 0;
   char c;
   char str[] = "W3Cschool Tutorials";
   
   while(str[i])
   {
      putchar (toupper(str[i]));
      i++;
   }
   
  return(0);
}

Let's compile and run the above program, which will result in the following:

W3CSCHOOL TUTORIALS

C standard library - <ctype.h> C standard library - <ctype.h>