这里写自定义目录标题
char* xstrcpy ( char *t, char *s )
{
/* Copy character pointed by s into location pointed by t,
check condition is true and then
point source and target to the next character */
while ( *t++ = *s++ );
return t;
}
条件变为 *t,因为最初将 *s 分配给 *t,然后,表达式变为 *t。 这类似于 while (i = 2)。 这里,首先将2分配给i,然后条件变为while(i)。
在这种情况下,由于首先进行复制,然后对条件进行评估,因此在循环的最后一次迭代中,‘\0’ 将首先被分配,然后通过 while ( *t ) 条件进行测试。 因此,一旦控制到达循环之外,就无需专门复制“\0”。