Hi everyone
Sorry for the delay in including the code that gives problem, this is:
#include <stdio.h>
typedef double (*f)(double);
double f1(double);
double f2(double);
double f3(double);
double func(f, double);
f gama(double, double*);
int main(int argc, char *argv[])
{
double x;
int i;
printf("Ingrese valor de X= ");
scanf("%lf", &x);
printf("Ingrese valor de i= ");
scanf("%d", &i);
f beta[3] = {f1, f2, f3};
printf("Valor de polinomio= %f\n", func(beta[i], x));
double m = 0.0;
double w = gama(x, &m)(m);
printf("valor de retorno desde funcion= %f\n",w);
return 0;
}
double f1(double x)
{
return x*x + 2.0*x + 1.0;
}
double f2(double x)
{
return x*x*x ;
}
double f3(double x)
{
return x*x + 2.0;
}
double func(f y, double x)
{
return y(x);
}
f gama(double x, double* z)
{
*z = x*2.0;
return f1;
}
This code gives me this answer when built:
Building main.obj.
fatal error: Internal error: 'Access violation' at 0x00007ff6cdf27b6a.
*** Error code: 1 ***
Done.
However it compile and works ok in CodeBlock and Visual Studio.
Also, it worked ok in Pelles 9.
Hope someone can tell me what is the problem.
Actually I switch to CodeBlock for my teaching.
Thanks!