Answered step by step
Verified Expert Solution
Question
1 Approved Answer
() 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, 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started