Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Advanced cstring function (write this function after lab and turn it in at the next lab for 10 bonus point on the first exam) One

image text in transcribed

Advanced cstring function (write this function after lab and turn it in at the next lab for 10 bonus point on the first exam) One last function for you to implement. Again, I will provide an overview of the algorithm, but I will not provide you with an implementation from me. You will need to write and test this function to get full credit strtok(): strtoko provides you with a different substring found in the original cstring parsed by a delimit character. Each time you call strtok() the next substring is returned. We will write a different version of strtok(). Our version will return an array of cstrings that is terminated with a value of NULL. Each string found prior to the NULL value will point back into the original cstring. The returned array needs to be dynamically allocated. We will follow this algorithm for dynamically resizing the array of cstrings. Our array will start out with 2 spots and will double in size anytime we need more memory. (If we determine that there are 5 substrings, your return array will need 8 spots.) The algorithm for strtok() is fairly simple. We will look at the cstring, that was passed, a character at a time. For each occurrence of the delimit character we will replace it with a '\0' and set a new pointer to the next spot in the cstring. It will continue to do this until the 'VO' is reached in the original cstring. You will need to write and test your solution to get full credit. Here is your prototype. char ** stuStrTok( char *, char )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 2 Lncs 8056

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013th Edition

3642401724, 978-3642401725

More Books

Students also viewed these Databases questions