Question: C++ ONLY PLEASE Exercise 2: Returning Pointers from Functions Suppose you want to write a function that passes an array argument, getRandomNumbers, to get a

C++ ONLY PLEASE

C++ ONLY PLEASE Exercise 2: Returning Pointers from Functions Suppose you want

Exercise 2: Returning Pointers from Functions Suppose you want to write a function that passes an array argument, getRandomNumbers, to get a pointer to an array of random numbers in the array. The function dynamically allocates an array, uses the system clock to seed the random number generator, populates the array with random values, and then returns a pointer to the array. Function getRandomNumbers to generate a random array and return a pointer. nt* getRandomNumbers(int nurn); requested. // The parameter indicates the number of numbers The algorithm can be described as follows: 1. Accept an array size as argument 2Dynamically allocate a new array that is the same size as the argument 3. White a loop to generate random numbers to the new array 4. Return result as a pointer

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!