C toupper function changes the letter to uppercase

Syntax

C toupper function has the following syntax.

int toupper(int ch);

C toupper function is from header file ctype.h.

Description

C toupper function returns the uppercase equivalent of ch if ch is a letter or ch is returned unchanged.

Example

The following code uses toupper function to convert letter a to A, and output the result with putchar function.


#include <ctype.h>
#include <stdio.h>
//from w  ww  . j a v  a  2  s .co  m
int main(void){
  putchar(toupper('a'));
}

The code above generates the following result.





















Home »
  C Language »
    Function Reference »




assert.h
ctype.h
math.h
setjmp.h
signal.h
stdio.h
stdlib.h
string.h
time.h
wctype.h