I need to create a function that will evaluate a polynomial at a point x, with the inputs of the function being the coefficients of the polynomial, the order n, and a scalar value of x.
I was given an example problem with a third order polynomial, and so when I wrote the code and the function I defined my arrays as P[4], and everything works fine. However, when I try to replace the 4's with a variable (so P[n+1] rather than P[4]), as it is supposed to work with any order polynomial, visual studio gives me errors like "'P' : unknown size" for all of my arrays.
If anyone could shed some light on what's going wrong, it would be greatly appreciated.