Question: Need this in c and plz complete code You only have to edit the code String splitting (30 points). Complete the str-split() function in strsplit..

Need this in c and plz complete code
You only have to edit the code
 Need this in c and plz complete code You only have
to edit the code String splitting (30 points). Complete the str-split() function
in strsplit.. The prototype of the function is char str.split(char s, char

String splitting (30 points). Complete the str-split() function in strsplit.. The prototype of the function is char str.split(char s, char delin) str.split O splits a string s into multiple fields separated by a delimiter delim. Each field is a string and a field can be empty. The output of the function is an array of char pointers, one for each field. The last pointer in the array is NULL, indicating the end of the fields. For example, if the delimiter is' ,', the input string a,b,c,d," has five fields. The returned array for string "a,b,c,d, " has six pointers: a pointer for each of the five fields plus a NULL pointer. Suppose the result of str.split) is stored in fields. Then the six pointers are: fields [0]: "a" fields [1]:"b fields [2]:c" fields [3]:"d" fields [4] fields [5]: NULL Note that the fields [4] is an empty string and fields [5] is NULL If the input string s does not have any delimiter, it has one field. The returned array would have two pointers: the first points to a copy of s and the second is NULL. If s is empty, the only field is an empty string. Your implementation of str.split() should dynamically allocate storage for the re- turned array and fields found in the input string. You must not change any characters in the input string. A function, free.fields), is provided in the template and called from the main function. Given a pointer returned from str.splitO, free.fields() frees the mem- ory allocated in str.split). Several test cases are hard coded in the mainO function. Optionally, the program also splits argv [1] if it is provided at command line. The expected output of the program without any arguments is available in a file called test strsplit output.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!