#include <stdio.h>
#include <stdlib.h>

int	length(char *str)
{
	if (*str)
		return (1 + length(str + 1));
	return (0);
}

char	*str_cat(char *dest, char *src)
{
	int	i;
	int	len;

	i = 0;
	len = length(dest);
	while (src[i])
	{
		dest[len] = src[i];
		len++;
		i++;
	}
	dest[len] = '\0';
	return (dest);
}

void	ft_free(char *str)
{
	int	i;

	i = 0;
	while (str[i])
	{
		str[i] = '\0';
		i++;
	}
}

char	*ft_strjoin(int size, char **strs, char *sep)
{
	int		i;
	int		len;
	char	*ptr;

	i = 0;
	len = length(sep) * (size - 1);
	while (i < size)
	{
		len += length(strs[i]);
		i++;
	}
	ptr = malloc(len);
	ft_free(ptr);
	i = 0;
	while (i < size)
	{
		if (i != 0)
			str_cat(ptr, sep);
		str_cat(ptr, strs[i]);
		i++;
	}
	ptr[len] = '\0';
	
	return (ptr);
}
int main() {
    char *array[] = {"aissam", "abouqassime"};
    char *sep = " ";
    printf("%s\n", ft_strjoin(2, array, sep));
    return 0;
}

Embed on website

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