Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

differentiate the function ( x + 1 ) / ( x ^ 3 + x - 6 )

Answered: 1 week ago

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago