aboutsummaryrefslogtreecommitdiff
path: root/ft_strncpy.c
blob: 100c81391ecad842f999c8f0a144e14967f78c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <string.h>

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

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