Question: C++ language Suppore you have a main() function with two local arrays, all the same size and type (say double). The first two are already
C++ language
Suppore you have a main() function with two local arrays, all the same size and type (say double). The first two are already initialized to values. Write a function called addArrays() that accepts the address of the two arrays as arguments; adds the contents of the two arrays together, element by element; and returns the result as a pointer. The function addArrays() returns a pointer to a double. The main() program declares a pointer which is set equal to addArrays using a statements like
int *numbers = nullptr;
and later on...
numbers = addArrays(arr1, arr2, ARRSIZE);
You must use pointer notation throughout the program. The only time when you may use brackets is when defining arrays or dynamically allocating memory. Otherwise, the expectation is that you use pointer notation throughout the design of your program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
