#include <stdio.h>
#include <stdlib.h>
int length(char *str)
{
    if (*str)
        return 1 + length(str + 1);
    return 0;
}
char *ft_strncpy(char *dest,char *src,int size)
{
    int i;
    
    i = 0;
    while (src[i] && i < size)
    {
        dest[i] = src[i];
        i++;
    }
    dest[i] = '\0';
    return dest;
}

char **ft_split(char *str, char *charset)
{
    int i;
    int len;
    char **array;
    
    while (array[i])
    {
        len += length(array[i]);
        i++;
    }
    *array = malloc(len + 1);
    int j = 0;
    while (str[i])
    {
        if (str[i] == charset[i])
        {
            ft_strncpy(array[j], str, i);
            str + i;
            j++;
        }
        i++;
    }
    return array;
}
int main() {
    char *string = "This is a test.";
    char *delimiters = " ";
    char array[] = ft_split(string, delimiters);
    printf("%c\n", array[0]);
    return 0;
}

Embed on website

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