retagged by
1,261 views
0 votes
0 votes
/*strcpy"copy t to s; */

void strcpy(char *s, char *t)

{

while((*s++=*t++) !='\0');

}

 

Can anyone explain how *s++ or *t++ is being executed. As * and ++ are unary operators here , they will have same precedence. Unary operators having same precedence are executed from right to left(right associative). So here if we take *s++ is the increment operator being executed first or the dereferencing operator?. Can anyone show the steps of executing this function.
retagged by

1 Answer

1 votes
1 votes
the value of *t++ is the character that t pointed to before t was incremented;the postfir ++ doesnt change t untill after this character has been fetched....

referce dennis m ritchie last para...go through that..

Related questions

3 votes
3 votes
0 answers
2
nishitshah asked Jan 26, 2018
621 views
Answer given is option C. How ?I gather that the character pointer will point to the first byte of the integer whose value is 255.But after that what should be the soluti...