Advertisement
sellmmaahh

stringic

Aug 10th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1.  
  2. #include<stdio.h>
  3.  
  4. void Fja (char *s1, char *s2, int vel1, int vel2)
  5. {
  6.     int i=0,h,n;
  7.     while (s1[i]!='\0')
  8.     {
  9.  
  10.         for (h=0; h<vel2; h++)
  11.         {
  12.             if (s1[i+h]==s2[h]) continue;
  13.             else break;
  14.         }
  15.        if (h-i==vel2) {
  16.             printf("String s2 se nalazi u s1.");
  17.             break;
  18.        }
  19.        i++;
  20.     }
  21.     do {
  22.  
  23.     s1[i]=s1[i+h];
  24.     i++;
  25.     }
  26.     while (s1[i+h]!='\0');
  27. }
  28.  
  29. int main () {
  30.     char s1[30]="Selma ne zna da programira";
  31.     char s2[10]="programira";
  32.     Fja(s1,s2,30,10);
  33.     printf("%s",s1);
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement