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 does the c in ctime mean?
What is the maximum no. of arguments that can be given in a command line in C.?
Explain Basic concepts of C language?
What is the process to generate random numbers in c programming language?
What is a example of a variable?
How can I pad a string to a known length?
Write a C program to count the number of email on text
Which control loop is recommended if you have to execute set of statements for fixed number of times?
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?
What is string function in c?
What are local static variables? How can you use them?
What is static memory allocation?
Explain what are compound statements?
What does double pointer mean in c?
What is the scope of local variable in c?