deleting a word with copy fuction c code

Solutions on MaxInterview for deleting a word with copy fuction c code by the best coders in the world

showing results for - "deleting a word with copy fuction c code"
Deirdre
09 Mar 2016
1 #include<stdio.h>
2  2 void my_strcpy(char*,char*);
3  3 void main()
4  4 {
5  5 int i;
6  6 char s[10],d[10],ch;
7  7 printf("Enter the source string...\n");
8  8 scanf("%s",s);
9  9 printf("Enter the charcter.....\n");
10 10 scanf(" %c",&ch);
11 11
12 12 for(i=0;s[i]!=0;i++)
13 13 {
14 14         if(s[i]==ch)
15 15         {       my_strcpy(s+i+1,s+i);
16 16                 i--;
17 17         }
18 18
19 19
20 20 }
21 21
22 22
23 23 printf("after the deleting s=%s",s);
24 24 }
25 25 void my_strcpy(char*s,char*d)
26 26 {
27 27 int i;
28 28 for(i=0;s[i]!='\0';i++)
29 29    d[i]=s[i];
30 30  d[i]='\0';
31 31 }
32~