Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

deleting a word with copy fuction c code

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