As the question says , i have this example that i tried to make as close as possible to my code :
double a = 0.0;
double *dxda1=&a;
void cof(double x, double a, double b, double* y, double* dxda)
{
x = pow((a * b) / 4, 2);
y = &x;
*dxda = (a / 8) * pow(b, 2);
}
void deriv()
{
double x =0.0;
double y = 0.0;
double dxda = 0.0;
double a = 50;
double b = 78;
cof(x, a, b, &y, &dxda);
dxda1 = &dxda;
}
int main()
{
deriv();
printf("whatineed: %g \n", *dxda1);
}
This example gives me the correct result which is 38025. But i would like to have to store the global variable and later print it in main without having to call the function deriv(). Is that possible?