Evaluate Polynomial Function
<p>Not sure where I'm going wrong in this, and it has to be in my polyEvaluate function, but any help would be appreciated. The problem is coming in the final calculation. I've tried modifying the function but that doesn't seem to fix the issue.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;math.h&gt;

double polyEvaluate(double coefficients[], int order, double x)
{
    int i, j;
    double polyExp[order], polyProd[order];
    double sum;
    double constant = coefficients[order];
    double temp;

    for(i=order-1; i&gt;0; i--){
        polyExp[i]=pow(x, i);
    }

    j=order;
    i=0;

    while (i&lt;j){
        temp=polyExp[i];
        polyExp[i]=polyExp[j];
        polyExp[j]=temp;
        i++;
        j--;
    }

    for(i=0; i&lt;order; i++){
        polyProd[i]=coefficients[i] * polyExp[i];
    }

    for(i=0; i&lt;order; i++) {
        sum+=polyProd[i];
    }

    sum+=constant;

    return(sum);
}

int main(void)
{
    int order, i;
    double input;
    double coefficients[order+1];

    printf("Enter the order of the polynomial: ");
    scanf("%d", &amp;order);

    printf("\nEnter the coefficients: \n");

    for(i=0; i&lt;=order; i++)
    {
        printf(" &gt;&gt; ");
        scanf("%lf", &amp;coefficients[i]);
    }

    printf("\nEnter the value of x: ");
    scanf("%lf", &amp;input);

    printf("\nThe value of the function is: %lf", polyEvaluate(coefficients, order, input));

    return(0);
}
</code></pre>