char *strncpy(char *dest, char *src, unsigned int n)
{
unsigned int a;
a = 0;
while (src[a] && a < n)
{
dest[a] = src[a];
a++;
}
while (a < n)//if src not bigger than n should I put '\0' at the end of dest ?
{
dest[a] = '\0';
a++;
}
dest[a] = '\0';
return (dest);
}
Hello Stackoverflow
I am looking for my mistake, I know that when n > strlen(dest), it does abort on the real strncpy and I am wondering why it is wrong ? Thanks for your help