Question: VectorSum (write in C++) Write a function named vectorSum that accepts a vector of integers as a parameter and returns an integer as output. The

VectorSum (write in C++)

Write a function named vectorSum that accepts a vector of integers as a parameter and returns an integer as output. The parameter should not be allowed to be modified by the function and the argument should be passed by reference.

The function should compute the sum of all elements within the array and then return the sum. The elements of the array will be between -100 and +100.

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!