Skip to content

Commit 95cd10e

Browse files
authored
Merge pull request #67 from sadeem-albir/patch-8
Optimized strcat.c
2 parents a54e787 + ff36537 commit 95cd10e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chapter_5/exercise_5_03/strcat.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ int main(void)
1818
void strcat_ptr(char *s, char *t)
1919
{
2020
// Find the end of s
21-
while ((*++s) != '\0')
22-
;
21+
while (*s)
22+
++s;
2323

2424
// copy t to the end of s
25-
while ((*s++ = *t++) != '\0')
25+
while (*s++ = *t++)
2626
;
2727
}

0 commit comments

Comments
 (0)