Home C-tutorials C String uppercase



C String uppercase
Posted on: February 6, 2009 at 12:00 AM
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:

Related Tags for C String uppercase:
cstringconvertiocharvaluethischaractercasecascharactersdefineexamplectetolearnexameareilsectionuppercasepelowercaseinasmtrcaaserchowppxawerxampsracishallivmpleaaractstrrtvassriringthavstalufinpleplono


More Tutorials from this section

Ask Questions?    Discuss: C String uppercase   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.