Register | Sing In

New posts

Stacks in C programming Linked Lists in C programming File Input/Output in C programming Check prime numbers in C Programming C Programming Enumeration C Programming Union

Archives

2013-10 2013-09 2013-08

C library function - toupper()

September 6, 2013 Posted by: GPA Views: 583 0 comments

Problem

C library function - tolower(). Write simple application using this function.

Solution

This function converts an uppercase letter to a uppercase letter and returns the uppercase letter. For using this function you must include <ctype.h> library.

Declaration:

int tolower(int value); 

where value is the character to be checked. 

If value is an lowercase letter, it returns value as a uppercase letter. Otherwise, it returns the argument unchanged.

Example:

 

   

 
#include <stdio.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
     char inputString[100];
char upperStringOutput[100];
     int i=0;
     printf("globalproganswer.com\n");
     printf("Enter string: ");//promt user to enter some value
     scanf("%s",&inputString);//read from keyboard
     //call function isupper and show result
     while(inputString[i])  {
        upperStringOutput[i]=toupper(inputString[i]);
        i++;
    }
   printf("Upper string is: %s\n",upperStringOutput);
    system("PAUSE");
  return 0;
} 

Output

c library function - toupper

Download this example

0 Comments...

Leave a Reply

Please, Sing In to leave a Reply for this material.



Online Chat

LiveZilla Live Help

Popular posts

Function strtok in C programming Check prime numbers in C Programming C Programming Union Linked Lists in C programming File Input/Output in C programming C Programming Enumeration

RSS-subscribe

New materials

Subscribe