I get errors on the lines where I'm attempting to multiply elements of the arrays. It says "expression must have arithmetic or unscoped enum type". What's wrong?
How are you calling this function? Are you sure you need double **xData which is a pointer to a pointer to a double, rather than just double *xData which is a pointer to a double. For an ordinary one-dimensional array, the latter would be more usual.