Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int strend(char *s1, char *s2)
  6. {
  7. int x=0,y=0,i=0,licznik=0;
  8. while(s1[x]!='\0')
  9. x++;
  10. while(s2[y]!='\0')
  11. y++;
  12.  
  13. for(i=0;i<y;i++)
  14. {
  15. if(s1[(x-y)+i]==s2[i])
  16. licznik++;
  17. }
  18. if(licznik==y)
  19. return 1;
  20. else
  21. return 0;
  22. }
  23.  
  24. int main(){
  25.  
  26. char a[]= "To jest funkcja";
  27. char b[]="funkcja";
  28.  
  29.  
  30. printf("%s",a);
  31. int wynik=strend(a,b);
  32. printf(" %d",wynik);
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement