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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by a sequential access file?

631


Explain what is a static function?

634


Not all reserved words are written in lowercase. TRUE or FALSE?

722


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

1718


Why isnt there a numbered, multi-level break statement to break out

591






Should a function contain a return statement if it does not return a value?

601


why wipro wase

1833


What is auto keyword in c?

792


What is main return c?

522


What is scanf_s in c?

635


What is the sizeof () a pointer?

552


What are the 5 types of organizational structures?

554


How can a program be made to print the line number where an error occurs?

654


What is #define used for in c?

618


What is external variable in c?

617