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

Is array name a pointer?

1002


How does struct work in c?

1035


What is c programing language?

1052


Hai what is the different types of versions and their differences

1903


Should I learn data structures in c or python?

984


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

1020


What are pointers really good for, anyway?

1022


Is c object oriented?

920


how many errors in c explain deply

2043


What are run-time errors?

1063


What is the role of this pointer?

998


Is it better to use a macro or a function?

1105


What are the loops in c?

955


what is bit rate & baud rate? plz give wave forms

1922


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1102