Question: Lab tasks (i) Write a function named copy that receives three integer arrays of same size and copy array1 in the start of array and

 Lab tasks (i) Write a function named copy that receives three

Lab tasks (i) Write a function named copy that receives three integer arrays of same size and copy array1 in the start of array and array2 in the end of array and returns newly created array. int* copy (int * array1, int * array, int* array2, const int SIZE). Example: array1 = 1,2,3 array = 4,5,6 array2 = 7,8,9 Newly Created Array = 1,2,3,4,5,6,7,8,9 (ii) Write a C++ function which takes an array of integer and its size as arguments. Firstly, the function should determine the number of even values present in the array. After that the function should dynamically allocate an array of integers to store those many values. Then, the function will copy all the even values from the original array into the newly allocated array. At the end, the function should return a pointer to the dynamically allocated array containing all the even values. The size of this new array will be returned through a reference parameter (see the 3rd argument in the function prototype given below). The prototype of your function should be: int * extractEvens (int* original, int origSize, int& newSize)

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!