#include #include #include "split.h" struct split_str * split(char * string, char exp, struct split_str *words){ int i=0, pos=0, offset=0; words = (struct split_str *) malloc (sizeof(struct split_str *)); while (string[i] != '\x0'){ words[pos].word = (char *) malloc (sizeof(char *)); for (;string[i] != exp && string[i] != '\x0' ;i++){ printf ("Put %c into words[%i].word[%i]\n", string[i], pos, offset); words[pos].word[offset] = string[i]; offset++; } while (string[i] == exp){ i++; } pos++; offset=0; } return words; }