#include <stdio.h>

unsigned int ft_strlcpy(char *dest, char *src, unsigned int size){
    char *src_debut = src;
    int longueur  = 0;
    if (size > 0){
        while (--size > 0 && *src != '\0'){
            *dest++ = *src++;
        }
        *dest = '\0';
    }
    while (*src_debut++ != '\0'){
        longueur++;
    }
    return longueur;
}
int main() {
    char src[] = "Coucou";
    char dest[7];

    int longueur = ft_strlcpy(dest, src, sizeof(dest));

    printf("%s\n", src);
    printf("%s\n", dest);
    printf("%d\n", longueur);

    return 0;
}

Embed on website

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