Code:
void func(char *s1, char *s2, char *s3){
while(*s1 != '\0' ) s1++;
while(*s2 != '\0' ) s2++;
for(; *s1=*s2=*s3; s1++, s2++, s3++);
}
main() {
char s1[10] = "ABC", s2[10]="DEF";
char s3[10] = "GHI";
func(s1,s2,s3);
printf("%s, %s %s", s1, s2, s3);
}
result => ABCGHI, DEFGHI GHI
Now I've got another problem...
at the end of for statement, pointer s1, s2, s3are all pointing to the '\0' character of each
string.
when you come back to main and print each string why does it print the whole thing? is it supposed to???
and oh, another one.
When does the for statement officially end??
how does it get "false" value to end the statement???