Skip to content

Commit 23a0b23

Browse files
committed
remove null check, K&R style!
1 parent 7860683 commit 23a0b23

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

chapter05/5-3.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ void strCat(char *, char *);
1313
/* concatenate t to end of s; s must be big enough */
1414
void strCat(char *s, char *t)
1515
{
16-
while (s && *s) /* find end of s */
16+
while (*s) /* find end of s */
1717
++s;
18-
while (s && t && (*s++ = *t++)) /* copy t */
18+
while ((*s++ = *t++)) /* copy t */
1919
;
2020
}
2121

2222
int main(void)
2323
{
24-
char str1[64] = { "conca" };
25-
char str2[] = { "tonate" };
24+
char str1[64] = "conca";
25+
char str2[] = "tenate";
2626

2727
strCat(str1, str2);
2828
printf("%s\n", str1);

0 commit comments

Comments
 (0)