beejjorgensen/bgc

30.4 Passing One-Dimensional VLAs to Functions: rename function add

Closed this issue · 1 comments

in that paragraph you have the function add

int add(int count, int *v)
{
    int total = 0;

    for (int i = 0; i < count; i++)
        total += v[i];

    return total;
}

I found it a little confusing. How about naming it total, sum, sum_up_to, or total_until?
i thought add was going to add something to the elements of the array.
I understand this is highly subjective, and that naming is hard!

sum() sounds better to me. 💯