#include <stdio.h>

char *ft_strjoin(int size, char **strs, char *sep)
{
        int i;
        char *result;
        int index;

        i = 0;
        index = size * 2 - 1;
        result = (char*)malloc(sizeof(char) * index);
        if(size < 0)
        {
                *strs = ""; 
                return *strs;
        }
        while(i < index)    
        {
                if (i % 2 == 1)  
                        result[i] = *sep;
                else
                        result[i] = (*strs)[i];
                i++;
        }
        return result;
}


int main(void)
{
        char **arr;
        char *r;
        int i = 0;
        arr = (char**)malloc(sizeof(char*) * 3);
        while(i < 3)
        {
                arr[i] = (char*)malloc(sizeof(char) * 2);
                i++;
        }
        strcpy(arr[0], "a");
        strcpy(arr[1], "b");
        strcpy(arr[2], "c");

        i = 0;
        r = ft_strjoin(3, arr, ",.");
        printf("%s", r);
        return 0;
}


Embed on website

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