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
If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.
What is the purpose of the statement: strcat (S2, S1)?
What does sizeof return c?
Can include files be nested? How many levels deep can include files be nested?
Explain continue keyword in c
Why do we need volatile in c?
State the difference between realloc and free.
What are keywords c?
How do you initialize pointer variables?
How to declare pointer variables?
what is stack , heap ,code segment,and data segment
Can you please explain the difference between syntax vs logical error?
In c programming language, how many parameters can be passed to a function ?
What are the string functions? List some string functions available in c.
Why are all header files not declared in every c program?