Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int mystrend(char *s, char *c) {
- int sLen = 0;
- int cLen = 0;
- while (*s != '\0') {
- s++, sLen++;
- }
- while (*c != '\0') {
- c++, cLen++;
- }
- if (cLen > sLen) {
- return 0;
- }
- while (*s == *c) {
- if (cLen == 0) {
- return 1;
- }
- s--, c--, cLen--;
- }
- return 0;
- }
- int main() {
- printf("%d\n", mystrend("abcd", "bd"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement