C - A function that calculates the integral of a polynomial I have written a simple function which takes an array of coefficients of a polynomial and then integrates it. My polynomial is represented like this:
$$polynomial[0] + polynomial[1]x + polynomial[2]x^2 + \dots + polynomial[n]x^n$$
And its integral will become: 
$$polynomial[0]x + \frac 1 2 polynomial[1]x^2 + \frac 1 3 polynomial[2] x^3 + \dots + \frac{1}{n+1}x^{n+1}$$

#include &lt;stdio.h&gt;

void integrate(double *polynomial, double *buff, int number_of_terms) {
    for(int i = 0; i &lt; number_of_terms; i++) {
        buff[i+1] = polynomial[i] / (i+1);
    }
    buff[0] = 0;
}

int main(void) {
    double polynomial[4] = {1, 2, 3, 4}; // 1 + 2x + 3x^2 + 4x^3
    double buff[5];
    integrate(polynomial, buff, 4);
    for(int i = 0; i &lt; 5; i++) {
        printf("%f, ",  buff[i]);
    }
    //Output: 0.000000, 1.000000, 1.000000, 1.000000, 1.000000
    //0 + x + x^2 + x^3 + x^4
}


The problem with my solution is that I need  to set the value at index zero manually - I don't think this is a good practice and therefore would like to somehow wrap the 0th index into the formula in the loop. Is there an easy way to do this?
buff is not a meaningful name. Call it integral perhaps?
I'd use a more mathematical degree rather than number_of_terms.
In your approach (going from lowest to highest degree) polynomial and buff may never overlap. restrict them:

void integrate(double * restrict polynomial, double * restrict buff, int number_of_terms)

I see no other way to deal with the integration constant but passing it as a separate parameter.