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

What are the data types present in c?

0 Answers  


How to implement call back functions ?

3 Answers   HP,


What's wrong with "char *p = malloc(10);" ?

4 Answers  


What does return 1 means in c?

0 Answers  


15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?

1 Answers  






CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.

9 Answers   Adobe,


what is the stackpointer

2 Answers  


disadvantages of realloc ?

1 Answers   HCL,


differentiate between const char *a; char *const a; and char const *a;

2 Answers   College School Exams Tests, HCL, TCS,


int i=10; printf("%d %d %d", i, i=20, i);

0 Answers  


How is actual parameter different from the formal parameter?

0 Answers  


What would be an example of a structure analogous to structure c?

0 Answers  


Categories