polyfit (var* coeff, vars Data, int TimePeriod, int order, var weight) : var
takes
"coeff A var[8] array for storing the calculated polynom coefficients,"
and modifies it

But what is the sense of the 8 values I wonder. My guess is that 0 is the y-intercept, 1 is the coefficient for the x term, 2 is the coefficient for the x^2 term, etc. Is that correct?
Can you please document this?