I passed a function to calculate the sum of all the numbers in an array but it outputs as 0 which is what I initialized it to. The function is in a separate file from the actual program (I also created a class called Stats). When I display the total sum in the function, it shows the correct number. It's only when I initialize it to 0 is where it goes wrong. How can I make it where when I pass the function, the total actually updates to the correct amount and not zero.

```
const int num = 12;
class Stats
{
private:
    double stats[num];
    double total = 0;
public:
    void setValue(double stats[num], int);
    double calcTotal(double stats[num], double);

};

double Stats::calcTotal(double stats[num], double total)
{
    total = 0;
    for (int i = 0; i < num; i++)
    {
        total += stats[i];
    }
    cout << total;
    return total;
}

int main()
{
    double rainFall[num];
    double total = 0;

    Stats rainStats;

    for (int i = 0; i < num; i++)
    {
        cout << "What was the rain fall for month #" << i + 1 << " ?" << endl;
        cin >> rainFall[i];
        rainStats.setValue(rainFall, num);
    }

    rainStats.calcTotal(rainFall, total);
    cout << total;
    return 0;
}

```

It prints out 0 in `int main()` but in `calcTotal`, it is the correct amount.