I'm failing at writing an OpenMP program that has to count an integral using a trapezes method.
The compiler screams at these lines:
x = calloc(n, sizeof(double));
y = calloc(n, sizeof(double));
error - a value of type "void *" cannot be assigned to an entity of type "double *"
I'm using Visual Studio 15 and yes, I enabled the OpenMP support in properties.
Here's the part of the program up to the mistake:
#define N 4
double start_time, end_time, time;
float f(float x)
{
return(pow(x, 3));
}
void main() {
start_time = omp_get_wtime();
int i, n; double *x, *y;
double x0, xn, h, so, ans;
x0 = 0;
xn = 2;
h = 0.1;
n = (xn - x0) / h;
if (n % 2 == 1)
{
n = n + 1;
}
x = calloc(n, sizeof(double));
y = calloc(n, sizeof(double));