The task is to reproduce the behavior of the function strcpy in C.
I found this code:
char *ft_strcpy(char *s1, char *s2)
{
int i;
i = 0;
while (s2[i])
{
s1[i] = s2[i];
i++;
}
s1[i] = s2[i];
return (s1);
}
I don't understand the while condition. Why can I just put "s2[1]" as condition? What does the condtion say in this context?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…