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 does the c in ctime mean?

574


What is the maximum no. of arguments that can be given in a command line in C.?

674


Explain Basic concepts of C language?

652


What is the process to generate random numbers in c programming language?

616


What is a example of a variable?

559






How can I pad a string to a known length?

615


Write a C program to count the number of email on text

1422


Which control loop is recommended if you have to execute set of statements for fixed number of times?

817


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

987


What is string function in c?

544


What are local static variables? How can you use them?

651


What is static memory allocation?

611


Explain what are compound statements?

609


What does double pointer mean in c?

584


What is the scope of local variable in c?

583