write a program to remove occurrences the word from entered
text?
Answer / 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 |
What are the data types present in c?
How to implement call back functions ?
What's wrong with "char *p = malloc(10);" ?
What does return 1 means in c?
15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?
CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.
what is the stackpointer
disadvantages of realloc ?
differentiate between const char *a; char *const a; and char const *a;
2 Answers College School Exams Tests, HCL, TCS,
int i=10; printf("%d %d %d", i, i=20, i);
How is actual parameter different from the formal parameter?
What would be an example of a structure analogous to structure c?