Question
Language: c++ Create a function that takes an integer array and the array size as input and copies the array to another array that is
Language: c++
Create a function that takes an integer array and the array size as input and copies the array to another array that is also input to the function. Assume that the second array is the same size as the first array. Both arrays should be declared in the main body of the program before calling the function. The first array should be initialized to random integer numbers. The function should be declared as follows: void copyArray(int[], int, int[]); The first int[] is the original array, the int is the size of the original array, and the second int[] is the copied array.
Test your function as follows: void copyArray(int [], int, int []); { 1. Create two arrays of 100 elements that are all initialized to zero.
2. Call randomArray to write random values to one of the arrays.
3. Call printArray for each array to verify the values in the arrays.
4. Call copyArray to copy the values from the array with random numbers to the second array.
5. Call printArray to verify the values in the second array. It should be identical to the first array.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started