Question: In C++ Define a function int * shuffle (int * p1, int len1, int * p2, int len2) that shuffles the arrays where the first
In C++
Define a function int * shuffle (int * p1, int len1, int * p2, int len2) that "shuffles" the arrays where the first array has base address p1 with length len1 and the second array has base address p2 with length len2. The function should return a dynamically allocated array containing all the shuffled elements. To shuffle, we start with element zero of p1, followed by element zero of p2, followed by element one of p1 and so on until the elements of (at least) one of the arrays are exhausted. If there are still elements remaining to process from the other array, then we just tack them on at the end. You must use pointer notation throughout the function. (No square brackets except to allocate an array.) Sample driver below. #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
