Problem 1 (splitting string - 15 points): Write a C function that splits a string line separated
Fantastic news! We've Found the answer you've been seeking!
Question:
Problem 1 (splitting string - 15 points): Write a C function that splits a string line separated by commas and stores the values in an array of strings fields. The number of commas is unknown and your function must be able to handle any number of commas in the string. Use the following built- in functions: strtok(line, delim); strtok(NULL, delim); malloc(strlen(token)); strcpy(fields[i],token); /* at the end of this function, fields will have n strings stored */ void split_line(char **fields,char *line) { int i=0; char *token, *delim; }
Posted Date: