Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
OseOse
· 13y ago · 0 comments
void strcpy(char *x, char *y) { while(*x++ = *y++); }
In this example, why does the loop terminate? Is it because the null terminator counted as a
false
?
Comments
[–]
tel
13y ago
Exactly, since C strings are just pointers to raw memory you usually assume that either the user passes the length explicitly to you or that they're \0-terminated.