I need help with using pointers to access 2 different values from the function I created. I would need these values for certain calculations in a separate function.
I have tried introducing a pointer in the function and assigning the inductance to it. But it's not printing anything.
This is my initial code before adding in the pointers.
double values(double, double);
int main(void)
{
values(a,b);
system("PAUSE");
return 0;
}
double values(double inductance, double capacitance)
{
//a = inductance; b = capacitance
printf("Please insert the inductance value (in mH):\n");
scanf("%lf", &inductance);
printf("Please insert the capacitance value (in microFarads):\n");
scanf("%lf", &capacitance);
printf("\n");
}
This is one of the things I tried. I tried several others. But I ended up confusing myself even more.
double values(double *inductance)
{
double induct;
printf("Please insert the inducatance value (in mH):\n");
scanf("%lf", induct);
*inductance = induct;
// printf("\n \n %p", induct);
printf("\n");
}
scanf("%lf", induct);-->scanf("%lf", &induct);