Skip to content

Commit 5322c6f

Browse files
authored
Make strend.c more concise
1 parent b6cc99f commit 5322c6f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

chapter_5/exercise_5_04/strend.c

Lines changed: 2 additions & 5 deletions
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)