void parse_line(const char *line, char **fields) {
int index = 0;
char *line_copy, *save;
char *token = NULL;
line_copy = save = strdup(line);
assert(line_copy != NULL);
while((token = strsep(&line_copy, ";")) != NULL)
fields[index++] = token;
free(save);
}
Hey guys!
After freeing save the first 2 fields are just gone the others are fine (they are 7 btw). Can someone just elucidate my mind on what is happening?