Answer:
//Function is written using C++ Programming Language
// Comments are used for explanatory purpose
// The main method is not included
using namespace std;
// Declare arraySum with two arguments. The first represents the array name while the other
// Represents the number of elements
int arraySum(int arr[], int n)
{
int total = 0; // declare and Initialise total to 0
// Iterate through the array to calculate sum
for (int i = 0; i < n; i++) {
total += arr[i];
}
return total;
}