aboutsummaryrefslogtreecommitdiff
path: root/ft_strncat.c
blob: 41e9f67b40364152bfa4208196a450a4ed80942b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <string.h>

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

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