#include <stdio.h>
char *ft_strncpy(char *dest, char *src, unsigned int n){
while (n > 0 && *src != '\0'){
*dest = *src;
dest++;
src++;
n--;
}
}
int main() {
char src[] = "Coucou";
char dest[7];
ft_strncpy(dest, src, 7);
dest[7] = '\0';
printf("%s\n", src);
printf("%s\n", dest);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: