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