Question: Use C++ coding language for answer. also leave comments too thx! 4. Running sum of arrays [10 points) Write a function with the following signature:
Use C++ coding language for answer. also leave comments too thx!

4. Running sum of arrays [10 points) Write a function with the following signature: void running_sum(int arr[], int size) This function takes in an array of int elements and the size of the array. It should replace all elements of the array with the partial sum up to and including that element. Example Input array: [1, 2, 3, 4] Output: [1, 3, 6, 10] Explanation: Why is the third element of the answer 6? Because in the original array, the first three elements add up to 6. Another way to look at the output is [1, 1+2, 1+2+3, 1+2+3+4]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
