Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Program to trim a given character from a string.

Answer Posted / raju kalyadapu

//Write a program to trim a Character from a Given String
#include<stdio.h>
int main()
{
int i,j;
char str[30],ch;
printf("Enter Any String: ");
gets(str);
printf("
Enter Character to Trim:");
ch=getchar();
for(i=0;i<strlen(str);i++)   
{
while(str[i]==ch)   
{
j=i;
str[i]=str[i+1];
while(j++<strlen(str))
{

str[j]=str[j+1];
}

}


}
str[i]='';
printf("
");
puts(str);
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the use of function toupper() with and example code?

1078


What is the function of multilevel pointer in c?

1026


How do I convert a string to all upper or lower case?

1057


Why is this loop always executing once?

999


What is the best way to comment out a section of code that contains comments?

1263


Can I initialize unions?

986


What is time complexity c?

941


Why isn't any of this standardized in c? Any real program has to do some of these things.

1148


Why is structure important for a child?

1049


What is graph in c?

1007


What is a pointer in c plus plus?

1218


Can i use “int” data type to store the value 32768? Why?

1143


What is a void pointer in c?

1040


Why do we use main function?

1112


What is the process of writing the null pointer?

980