toupper - C ctype.h

C examples for ctype.h:toupper

Type

function

from

<cctype> 
<ctype.h>

Description

Convert lowercase letter to uppercase

Prototype

int toupper ( int c );

Parameters

Parameter Description
c Character to be converted, casted to an int, or EOF.

Return Value

The uppercase equivalent to c, if such value exists, or c (unchanged) otherwise.

The value is returned as an int value that can be implicitly casted to char.

Demo Code


#include <stdio.h>
#include <ctype.h>
int main ()/*from   w  w w  .  j a  v  a 2s  .c  o m*/
{
  int i=0;
  char str[]="This is a test. Test String.\n";
  char c;
  while (str[i])
  {
    c=str[i];
    putchar (toupper(c));
    i++;
  }
  return 0;
}

Related Tutorials