a fast cumulative sum over a array in c

A already said in comments, this would be sufficient :

int main()
{
   double arr[10] =  {1., 2., 3., 4., 5., 6., 7., 8., 9., 10.};
   
   for (char i=1; i<10; i++) {
       arr[i] = arr[i] + arr[i-1]; 
       printf("%f\n", array[i]); 
   }
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top