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

What is c language & why it is used?

1116


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1096


How do I swap bytes?

1080


What are different types of variables in c?

1080


What is scanf () in c?

1130


Is c dynamically typed?

1165


Can variables be declared anywhere in c?

1095


Explain how do you use a pointer to a function?

1113


can any one provide me the notes of data structure for ignou cs-62 paper

2179


What is the advantage of c?

1132


Differentiate between functions getch() and getche().

1055


What is gets() function?

1139


What Is The Difference Between Null And Void Pointer?

1262


What is I ++ in c programming?

1124


Can we initialize extern variable in c?

1140