I have a new homework assignment that has to do with arrays. I am strugling to grasp the concept. I keep reading the chapter over and over but still don't know what to do.
Here is the problem: 1. Write a function
double sum(double a[ ], int n)
that returns the sum a[0]+a[1]+...+a[n-1]. Then write a main program that initializes an
array as follows:
y[0]=1/20 , y[1]=1/21 , y[2]=1/22 ,..., y[n-1]=1/2n-1 .
What should I do?
This is what I have for the first part:
1 2 3 4 5 6 7
void sum (double a[], int n)
{
for (int i = 0; i<n; i++)
}