Please solve using C language The function get_tokens gets a string str, and a char delim, and returns the array with the tokens in the correct order. The length of the array should be the number of tokens, computed in count_tokens. char** get_tokens(const char* str, char delim); For example: ● get_tokens("abc-EFG--", '-') needs to return ["abc","EFG"] ● get_tokens("++a+b+c", '+') needs to return ["a","b","c"]. ● get_tokens("***", '*') needs to return either NULL or an empty array. Note that the returned array and the strings in it must all be dynamically

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section: Chapter Questions
Problem 2PP
icon
Related questions
Question

Please solve using C language

The function get_tokens gets a string str, and a char delim, and returns the array with the tokens in the correct order. The length of the array should be the number of tokens, computed in count_tokens.

char** get_tokens(const char* str, char delim);

For example:

● get_tokens("abc-EFG--", '-') needs to return ["abc","EFG"]

● get_tokens("++a+b+c", '+') needs to return ["a","b","c"].

● get_tokens("***", '*') needs to return either NULL or an empty array.

Note that the returned array and the strings in it must all be dynamically allocated. 

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr