3 /* strcmp - compare strings */
4 /* return <0 is s < t; 0 if s==t; >0 if s>t */
5 int strcmp(char *s
, char *t
)
8 for(i
= 0; s
[i
] == t
[i
]; i
++)
11 return i
; // might need to change
15 /* strlen - return length of string */
16 int strlen_new(char *s
)
19 for(n
=0; s
[n
] != '\0'; n
++);
23 /* strend - compares end of string s with string t */
24 /* return 1 if string t occurs and 0 otherwise */
25 int strend(char *s
, char *t
)
28 ls
= strlen_new(s
); // find length of s
29 lt
= strlen_new(t
); // find length of t
31 // start with end of s and move back comparing with end of t
34 if(s
[ls
] != t
[lt
]) { return 0; }
44 char s
[] = { "1234567890" };
45 char t
[] = { "67890" };
47 int ans
= strend(s
,t
);