This is the code I have written so far. Right now the code only gets the polynomial, later it will create the derivative. The error is not in the code itself. It runs until all the coefficients are input and then I get the bad access thing.
using namespace std;
double poly(double, int);
double drv(double, int, double);
int main ()
cout << "Enter the degrees of the polynomial: ";
cin >> n;
for (int i=n; i>=0; i--)
cout << "Enter the coefficient for the variable of degree " << i << ": ";
cin >> c[i];
cout << "The polynomial entered is: " << poly(c,n) << endl; //I think this is where it's messing up
double poly(double c, int n)
for (int i=0; i<=n; i--)
You are allocating an array with a non-constant (line 15)
The compiler compiles it until it reaches the point where it's supposed to pick up from the function, so something is wrong with the function. The x is because I want it to say that it's the coefficient (c) times x^i, because later on in the program I need it to take the derivative.