#include <stdio.h> #include <math.h> double integrateF(double low, double high) { double low = 0; double high = 20; double delta_x=0; double x, ans; double s = 1/2*exp((-x*x)/2); for(x=low;x<=high;x++) delta_x = x+delta_x; ans = delta_x*s; return ans; }
It says that low and high are “redeclared as different type of symbol” and I don’t know what that means. Basically, all I’m doing here (READ: trying) is integrating from low (which I set to 0) to high (20) to find the Riemann sum. The for loop looks kinda trippy too…I’m so lost.
EDIT:
#include <stdio.h> #include <math.h> double integrateF(double low, double high) { low = 0; high = 20; double delta_x=0; double ans = 0; double x; double s = 1/2*exp((-x*x)/2); for(x=low;x<=high;x++) { delta_x = x+delta_x; ans = ans+(delta_x*s); } return ans; }
^That still doesn’t work, after the braces and all. It says “undefined reference to ‘WinMain@16′”…