Question: Write a function that takes a string and splits it up to an array of strings. The split will be length-based: the function will also
Write a function that takes a string and splits it up to an array of strings. The split will be length-based: the function will also take an integer n and will split the given string up into strings of length n. It is possible that the last string will not be of length n. You will not need to communicate how large the resulting array is as the calling function knows the string length and n. char **lengthSplit(const char *s, int n); For example, if we pass "Hello World, how are you?" with n = 3 then it should return an array of size 9 containing the strings "Hel" , "lo " , "Wor" , "ld," , " ho" , "w a" , "re " , "you" , "?"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
