How does this While loop work?

Hello, I was reading a c++ book for beginners, and i came across a program that takes two strings and 'tack' one to the end of another, i understood most of it, but there was one part (a loop) that i didn't understand

12345678

void concatString(char* pszTarget, char* pszSource) //takes Source and tacks it //to the end of Target
{
while(*pszTarget)
pszTarget++; //find the end of pszTargetwhile(*pszTarget++ = *pszSource++); /*Here is the part i didn't understand*/
}

The while loop, according to the book, is suppose to copy pszSource to the end of pszTarget. What i don't understand is how the null character is also copied, and how (*pszTarget++ = *pszSource++) would eveluate to true or false, does the assignment operator return something?
Thanks in advance :D

In C++ each expression can have value that can be casted to bool. Everything except 0, '\0' and null evaluates to true. The three evaluae to false. Because of this, we can use various expressions as conditions for while loops.
It is important to remember, that assignment x = y is also an expression that evaluates to whatever value is being assigned, and that in turn can be cast to boolean and be either true (for anything) or false (for nothing, zero, null).

Consider the following case:

12345678910111213141516171819202122232425262728

char Text[200] = "I don't get it"; // The sentence has 15 letters // (so Text[0] to Text[14] // are filled, and by C++ magic a '\0' // character is put in Text[15])// Elements 16-199 are uninitialized.char Source[200] = "Please, explain"; // As abovechar * pszTarget = Text; // pointer points to Text[0];char * pszSource = Source; // points to Source[0];while(*pszTarget) // Meaning untill pszTarget hits '\0', 0 or null
pszTarget++; // Point to next element // - goes through Text[0] to Text[15]// At this point pszTarget points at Text[15]while(*pszTarget++ = *pszSource++);
// Assigns Text[15] value taken from Source[0]// Repeats for Text[16] and Source[1] by magic of ++ operators, and so on// When reaches Source[15] it turns out it is '\0', // so '\0' is assigned to Text[29]. // Now, since the value of expression (x = y) is y,// the value of (*pszTarget = *pszSource]) can be // dereferenced as Text[31] = Source[15] - which is '\0' .// And this is the breaking condition to the second while loop).