Mark, > My question is, could you explain why it is good to move both the asignment > operation and the increment operation into the while test portion? It's not so much a "good"thing as it is a consise thing. The second example allows the "experienced" C programmer to see everyhting that's going on in one fell swoop. There are two camps here: the ones who want to see everything on the least lines possible and those that would opt for example #1 where everything is a little easier to see. (I would offer a third example where the assigment statement, *s = *t, is taken out of the while() statement and given a line of it's own.) Any good compiler (subjective, I know) should be able to generate roughly the same amount of code for all (two/three?) examples. > Also, what is the logic behind understanding the actual test in the while > loop? I can't understand from the syntax exactly what is being compared to > '\0'. Is it *s? *t? If so, why? Well, since the char at the location pointed to by t is placed into the location pointed to by s, they both should now contain the same data. So it doesn't matter which location gets compared to zero. (\0). Douglas Wood Software Engineer dbwood@kc.rr.com Home of the EPICIS Development System for the PIC and SX http://epicis.piclist.com > On page 105 of "The C Programming Language", there are two versons of > function strcpy: > > version 1: > void strcpy(char *s, char *t) > { > while ((*s = *t) != '\0') { > s++; > t++; > } > } > > version 2: > void strcpy(char *s, char *t) > { > while ((*s++ = *t++) != '\0') { > ; > } > } -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.