Question: Using C A function return_string with a return type char* is predefined and it takes a char array (source string) and an integer as arguments.
Using C
A function return_string with a return type char* is predefined and it takes a char array (source string) and an integer as arguments. A variable char* result and int tmp are already declared in the function return_string. Allocate memory for the result variable (using malloc) and copy specific bytes (defined by the variable tmp) of the the source string to it. The function returns the result. Only submit the portion of the code used to allocate memory to the variable result and to copy the string. Hint - memcpy
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
