Question: () Write a C function, extract_substring () that takes a string, s, and two integers, i and j as its parameters and returns a pointer

 () Write a C function, extract_substring () that takes a string,

() Write a C function, extract_substring () that takes a string, s, and two integers, i and j as its parameters and returns a pointer to a newly allocated region of memory containing a copy of the substring of s from s[i] to s[j], inclusive. If either i or j lie outside of s, the end of the substring is the appropriate end of s. If i is greater than j, the substring will be reversed. Write robust code. That is, return NULL on failure, but do not crash under any circumstances. Think before you write anything; it's easier than it sounds. char *extract_substring ( char s, int i, int j){

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!