I read this in a strcpy funciton.
while (*dst++ = *src++)
;
I'm not really sure the execute order. who can help me?
I read this in a strcpy funciton.
while (*dst++ = *src++)
;
I'm not really sure the execute order. who can help me?
The postfix ++
operator increments the value of a variable after the statement it's in has been executed. According to C's precedence rules, the expression will be evaluated something like this:
while (*(dst++) = *(src++));
Which will basically:
dst
points to to the character src
points to.dst
and src
'\0'
, end the loop.