C library function - toupper()


Advertisements

Description

The C library function int toupper(int c) converts lowercase letter to uppercase.

Declaration

Following is the declaration for toupper() function.

int toupper(int c);

Parameters

  • c − This is the letter to be converted to uppercase.

Return Value

This function returns uppercase equivalent to c, if such value exists, else c remains unchanged. The value is returned as an int value that can be implicitly casted to char.

Example

The following example shows the usage of toupper() function.

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

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

Let us compile and run the above program to produce the following result −

TUTORIALS POINT
ctype_h.htm

Useful Video Courses


Video

JCL Online Training

12 Lectures 2 hours

Nishant Malik

Video

COBOL Online Training

12 Lectures 2.5 hours

Nishant Malik

Video

CRO Online Training

48 Lectures 6.5 hours

Asif Hussain

Video

Customer Service Online Training

12 Lectures 2 hours

Richa Maheshwari

Video

Cultivation of Crops

20 Lectures 3.5 hours

Vandana Annavaram

Video

Eclipse Online Training

44 Lectures 1 hours

Amit Diwan

Advertisements