About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Tuesday, September 3, 2013

Program to Convert String into Uppercase Using Library Function

Program 1 :
#include
#include
#include
void main()
{
char *string = "Pritesh Taral";

printf("String before to strupr : %sn", string);
strupr(string);
printf("String after strupr : %sn", string);

getch();
}
Output :
String before to strupr : Pritesh Taral
String after strupr : PRITESH TARAL

Program 2 :
#include
#include
#include
void main()
{
char string[100];

printf("Enter String : ");
gets(string);
strupr(string);
printf("String after strupr : %sn", string);

getch();
}
Output :
Enter String : Pritesh Taral
String after strupr : PRITESH TARAL
Explain me ?
  1. strupr : Converts all Letters from given String into equivalent Uppercase Letters
  2. Uppercase Letters Remains as It is .
  3. Digits and Spaces also remains same , only lowercase letter gets modified.
  4. strlwr functions is included in Header File : string.h

No comments: