Home C-tutorials C String uppercase

Related Tutorials


 
 

Share on Google+Share on Google+

C String uppercase

Advertisement
In this section, you will learn how to convert a string value in to uppercase. In the given example, we have define a string in lowercase characters.

C String uppercase

     

In this section, you will learn how to convert a string value in to uppercase. In the given example, we have define a string in lowercase characters. Therefore, in order to convert the characters of string in uppercase (A to Z), we have used the library function toupper() provided by the header file <ctype.h>.

<ctype.h> - This header file is used for testing and converting characters. 

Here is the code:

 

 

 

STRINGUP.C

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

int main(void) {
  char st[40]="hello world";
  int i;
  for (i = 0; st[i]; i++)
  st[i= toupper(st[i]);
  printf("The uppercase of String= %s\n", st);
  getch();
  return 0;
}

Output will be displayed as:

STRINGUP.EXE

Download Source Code:

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 6, 2009

Related Tutorials

Discuss: C String uppercase   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:4
kishan chand kashyap
February 10, 2012
c++

what is c++.?
Dheerendra
April 5, 2012
plz reply me answer

i/p hello world o/p HeLLo worLd code in C
gehad hamdy
August 28, 2012
about the string uppercase

all the examples about the character uppercase we want the string uppercase
Brian
October 26, 2012
Thank you

Thank You
DMCA.com