Yes. It must be a boolean expression, can be anything inside of it.
The way this works is as follows:
void mystery1( char *s1, const char *s2 )
{
while ( *s1 != '\0' ) // NEW: Stop when encountering zero character, aka string end.
s1++;
// NEW: Now, s1 points to where first string ends
for ( ; *s1 = *s2; s1++, s2++ )
// Assign currently pointed to character from s2 into s1,
// then move both pointers by 1
// Stop when the value of the expression *s1=*s2 is false.
// The value of an assignment operator is the value that was assigned,
// so it will be the value of the character that was assigned (copied from s2 to s1).
// Since it will become false when assigned is false, aka zero, aka end of string,
// this means the loop will exit after copying end of string character from s2 to s1, ending the appended string
; // empty statement
}
}
What this does is copy all characters from s2 onto the end of s1, basically appending s2 to s1.
Just to be clear, \n
has nothing to do with this code.