Hello,
I am going through my C book when I ran across something I don't understand about the while loop. The book uses the below option1 and says I can replace it with option2. It does work. I just am clueless on why.
My 3 questions about option2 are:
1) How does the "=" sign work in the condition spot?
2) The "=" works but is it proper? I am use to the true/false conditions...
3) This will probably be answered in question 1 but, how does the "\0" at the end of the string get copied?
option1
option2Code:while(str2[count2]) /* Copy up to null from str2 */ str1[count1++] = str2[count2++]; str1[count1] = '\0'; /* Make sure we add terminator */
Thanks!Code:while((str1[count1++] = str2[count2++]));