Hey guys, my instructions are to create a program that approximates the area using Simpson's Rule. I set it up the way my book shows, however it is giving me the following error message:

'function' cannot convert from 'double *' to 'double'

and

a warning that says: different types for formal and actual parameter 1

What do these mean?

Here is the part of the code that it applies to:

Code:

double f(double *ptr, double x, int degree)
{
double sum = 0;
int i;
for(i = 0; i <= degree; i++)
{
sum = sum + ptr[i] * pow(x,i);
return(sum);
}
}
double rectangular(double *ptr, double a, double b, double n,int degree)
{
double area = 0;
double totarea = 0;
double k = 0;
double width = (b - a) / n;
double widthplus = (b - a) / n;
double height = 0;
for(k = n; k > 0; k--)
{
for(degree = degree; degree >= 0; degree--)
{
if(degree != 0)
{
height = height + (pow(ptr[degree],degree));
}
else
{
height = height + (ptr[degree]);
}
}
area = height * width;
totarea = totarea + area;
widthplus = widthplus + width;
}
return(totarea);
}
double simpsons(double *ptr, double a, double b, double n, int degree)
{
double answer = 0;
double h;
double x;
int i;
h = (b - a) / n;
answer = f(ptr,a,degree);
for(i = 1; i <= n; i++)
{
x = a + i*h;
answer = answer + 4 * f(ptr,x - (h/2),degree) + 2 * f(ptr,x,degree);
}
answer = answer - f(ptr,b,degree);
return(h*answer/6);
}

Thanks for the help.