/* return 1 if string t occurs and 0 otherwise */ int strend(char *s, char *t) { int ls, lt; ls = strlen_new(s); // find length of s lt = strlen_new(t); // find length of t // start with end of s and move back comparing with end of t while(lt >= 0) { if(s[ls] != t[lt]) { return 0; } --ls; --lt; } return 1; }
int main() { char *s = "ABCDEFGHIJ"; int lengthOfS = 0; lengthOfS = strlen_new(s); printf("The length of the string '%s' is %d\n", s, lengthOfS); return 0; }