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
What do you mean by a sequential access file?
Explain what is a static function?
Not all reserved words are written in lowercase. TRUE or FALSE?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
Why isnt there a numbered, multi-level break statement to break out
Should a function contain a return statement if it does not return a value?
why wipro wase
What is auto keyword in c?
What is main return c?
What is scanf_s in c?
What is the sizeof () a pointer?
What are the 5 types of organizational structures?
How can a program be made to print the line number where an error occurs?
What is #define used for in c?
What is external variable in c?