write a program to remove occurrences the word from entered
text?



write a program to remove occurrences the word from entered text?..

Answer / jitendra

#include"stdio.h"
#define n 100
void del_char(char str1[n],char str2[])
{
char str[n],*p1,*q,i,j;
p1=str1;
q=str;
*q=*p1;
i=0;
while(*p1!='\0')

{
{
if(*p1==str2[i])
{
p1++;
i++;
if(*p1==str2[i])
{
p1++;
i++;
if(*p1==str2[i])
{
p1++;
i++;
}
else
{
q++;
}
}
else
{
q++;
}
}
else
{
p1++;
q++;

}
*q=*p1;
}
i=0;
}
printf("%s\n",str);
}
main()
{
char str1[n],str2[]={"to "};

printf("please enter a text and includ 'to':\n");
gets(str1);
printf("remove 'to',remaining :\n");
del_char(str1,str2);
getch();}

Is This Answer Correct ?    5 Yes 7 No

Post New Answer

More C Interview Questions

Can you think of a way when a program crashed before reaching main? If yes how?

2 Answers  


In c language can we compile a program without main() function?

0 Answers  


In CMM or CMMI certified organizations,we assess only the standard software processes of the organization. We do not assess the organizations other functional departments like HR or Admin. Then how can we certify the entire organization as CMM level company?? We have assessed only software related activities. Right. There is no relation with other departments like Accounts, HR or Admin. Then how can we claim that the whole company is a CMM certified company?

1 Answers   Melstar,


Study the Following Points: a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static 1. Which of the Following Statements are true w.r.t Bit- Fields A)a,b&c B)Only a & b C)Only c D)All

3 Answers   Accenture,


who is the father of c

4 Answers   Infosys,






What kind of structure is a house?

0 Answers  


What is ponter?

0 Answers   TCS,


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

0 Answers  


What is the difference between NULL and NUL?

0 Answers   Aspire, Infogain,


What is || operator and how does it function in a program?

0 Answers  


What is a global variable in c?

0 Answers  


What is default value of global variable in c?

0 Answers  


Categories