Going through K&R I saw the following code snippet of a function, strcopy, which copies a character array to another.
If t is the pointer to the first array, and s is the pointer to the array which t is copied to, the code is:
void strcopy(char *s, char *t){
while(*s++=*t++)
;
}
I'm confused by the while loop. I undersatnd that inside the condition t is copied to s, but I don't understand what condition is being tested here. When will *t++ be false (or zero)? Presumably, when the character string finishes. We can test whether the string is finished by checking if the character pointed at is '\0'. K&R says as much. But then the book rather blithely points out that this test isn't necessary. So I'm wondering what is being tested here?