#include <unistd.h>
#include <stdio.h>

char	*ft_strncpy(char *dest, const char *src, unsigned int n)
{
	unsigned int	i;

	i = 0;
	while (i < n && src[i] != '\0')
	{
		dest[i] = src[i];
		i++;
	}
	while (i < n)
	{
		dest[i] = '\0';
		i++;
	}
	return (dest);
}

int main()
{
    char str[] = "hello world";

    ft_strncpy(str, "test", 10);
    printf("%s\n", str);
    printf("%c", str[11]);

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: