Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int strend(char *s1, char *s2)
- {
- int x=0,y=0,i=0,licznik=0;
- while(s1[x]!='\0')
- x++;
- while(s2[y]!='\0')
- y++;
- for(i=0;i<y;i++)
- {
- if(s1[(x-y)+i]==s2[i])
- licznik++;
- }
- if(licznik==y)
- return 1;
- else
- return 0;
- }
- int main(){
- char a[]= "To jest funkcja";
- char b[]="funkcja";
- printf("%s",a);
- int wynik=strend(a,b);
- printf(" %d",wynik);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement