Skip to content

Commit

Permalink
Merge pull request #67 from sadeem-albir/patch-8
Browse files Browse the repository at this point in the history
Optimized strcat.c
  • Loading branch information
ohkimur authored Apr 1, 2024
2 parents a54e787 + ff36537 commit 95cd10e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chapter_5/exercise_5_03/strcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ int main(void)
void strcat_ptr(char *s, char *t)
{
// Find the end of s
while ((*++s) != '\0')
;
while (*s)
++s;

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

0 comments on commit 95cd10e

Please sign in to comment.