#include <stdio.h>
#include <stdlib.h>
typedef struct s_stock_str
{
int size;
char *str;
char *copy;
} t_stock_str;
int length(char *str)
{
    if (*str)
        return (1 + length(str + 1));
    return (0);
}
char *ft_strdub(char *str)
{
    int i;
    int len;
    char *ptr;
    
    i = 0;
    len = length(str) + 1;
    ptr = malloc(len);
    while (str[i])
    {
        ptr[i] = str[i];
        i++;
    }
    ptr[len] = '\0';
    return (ptr);
}
struct s_stock_str *ft_strs_to_tab(int ac, char **av)
{
    struct s_stock_str *array;
    int i;
    int len;
    i = 0;
    array = malloc(sizeof(struct s_stock_str)* (ac + 1));
    while (i < ac)
    {
        array[i].size = length(av[i]);
        array[i].str = av[i];
        array[i].copy = ft_strdub(av[i]);
        i++;
    }
    array[i].str = '\0';
    return array;
}
int main() {
    char *arr[] = {"aissam","abouqassime"};
    t_stock_str *w = ft_strs_to_tab(2, arr);
    int i = 0;
    while(w[i].str)
    {
        printf("%s\n", w[i].copy);
        i++;
    }
    return 0;
}

Embed on website

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