I'm trying to reproduce the behaviour of strcpy
in c, my problem is that the function works but it append extra stuff at the end.
char *ft_strcpy(char * dst, const char * src)
{
int i;
i = 0;
while (src[i] != '\0') {
dst[i] = src[i];
i++;
}
return dst;
}
When i run it I get the following.
int main()
{
char p[] = {};
char z[] = "Hello World";
ft_strcpy(p,z);
printf("%s\n", p);
return 0;
}