hi,
how to convert a given lower case string into upper case
hi,
how to convert a given lower case string into upper case
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
two ways :
1) using a pre defined function toupper() which requires the header file ctype.h to be included in your program.
e.g
char f1=’h’;
f1=toupper();
now f1=’H’
2) you can also define a function which uses the ASCII values of characters if the character is a lower case laphabet subtract 32.
char arr[]=”HELLO WORLD”;
for(i=0;i<strlen(arr);i++)
{
arr[i]=toupper(*(arr+i));
}
sorry its tolower
#include
int main()
{
char str[];int l;
pf(“\nenter any name=”);
sf(“%s”,&str);
l=0;
while(str[l] !=”)
{
str[l] = str[l] – 32;
l++;
}
pf(“\nupper case = %s”,str);
return 0;
}
this is str[l]!= ”………….