Home C-tutorials C String lowercase
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

C String lowercase

Advertisement
In this section, you will study how to convert the string to lowercase. You can see in the given example, we have define a string in uppercase characters.

C String lowercase

     

In this section, you will study how to convert the string to lowercase. You can see in the given example, we have define a string in uppercase characters. Therefore, in order to convert the characters in lowercase (a to z), we have used the library function tolower() provided by the header file <ctype.h>.

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

Here is the code:

STRINGLO.C

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

void main() {
  char st[40]="HELLO WORLD";
  int i;
  for (i = 0; st[i]; i++)
  st[i= tolower(st]);
  printf("The lowercase of String= %s\n", st);
  getch();
}

Output will be displayed as:

STRINGLO.EXE

Download Source code:

 

Advertisements

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

Ask Questions?    Discuss: C String lowercase  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com