<p>Looking at this loop that copies one c-string to another:</p>

<pre><code>void strcpyr(char *s, char *t)
{
    while(*s++=*t++)// Why does this work?
        ;
}
</code></pre>

<p>Why do we not check for the '\0' character in the while loop, like this?</p>

<pre><code>while((*s++=*r++)!='\0')..
</code></pre>

<p>How does the first loop terminate?</p>

When we hit the
```
'\0'
```
in the string initially pointed to by
```
t
```
, the
```
*s++=*t++
```
, which does the assignment, also returns the value that's assigned to the position pointed to by
```
s
```
, or
```
'\0'
```
, which evaluates to
```
false
```
and terminates the loop.
In your second example, you explicitly rely on the fact that the assignment returns the assigned character, while the first example implicitly uses this fact (and the fact that the
```
0
```
character (also written
```
'\0'
```
) is considered to be false, while all other characters evaluate to true, so the expression
```
c != '\0'
```
will yield the same result as
```
c
```
.