Program to trim a given character from a string.

Answer Posted / dj

#include<iostream>
using namespace std;
#include<string.h>
int main()
{
char string[]="lhellolollla";
int i=0;
int count=0;
while(i<strlen(string))
{
while(string[i+count]=='l')
count++;
string[i]=string[i+count];
i++;

}
printf("%s",string);
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is adt in c programming?

602


How many types of arrays are there in c?

587


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

770


What is the use of parallelize in spark?

569


What are register variables? What are the advantage of using register variables?

671






What does void main return?

597


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

808


Explain the difference between malloc() and calloc() in c?

569


What is an lvalue in c?

687


How can I call fortran?

633


Does c have class?

605


What are header files and what are its uses in C programming?

623


How many levels of pointers can you have?

695


What is a static function in c?

612


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

649