Skip to content

Commit 3bde806

Browse files
authored
Merge pull request #75 from jerryq0101/patch-1
Make strend.c more concise
2 parents 7d7037d + 5322c6f commit 3bde806

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

chapter_5/exercise_5_04/strend.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ int strend(char *s, char *t)
3737

3838
// Check backwards if each character from string t occurs in the corresonding
3939
// location from the string s.
40-
while (t_length && (*s-- == *t--))
40+
while (*s-- == *t--)
4141
--t_length;
4242

43-
if (t_length)
44-
return 0;
45-
46-
return 1;
43+
return !t_length;
4744
}

0 commit comments

Comments
 (0)