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 is volatile, register definition in C
What functions are used in dynamic memory allocation in c?
What are structure members?
What is the advantage of an array over individual variables?
What are the different types of data structures in c?
Can the “if” function be used in comparing strings?
What standard functions are available to manipulate strings?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
What is f'n in math?
What is register variable in c language?
Which is best linux os?
What is the usage of the pointer in c?
Explain what is the difference between far and near ?
Why is main function so important?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER