0

Hi,

I seem to be having a problem with my code below, which I would like to be able to use to return 2 values from the result of a quadratic equation operation. The eReturn function takes care of negative square root values. I'm not getting any errors back, just both of my results as 0.

```
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void eReturn()
{
printf("\nOne or both of your answers is complex.\n");
return;
}
void QuadFormula(float a, float b, float c)
{
float x1, x2, y, dis, *d, *e;
dis = ((b*b)-(4*a*c));
if (dis<0)
eReturn();
else if (dis>0)
{
y = sqrt(dis);
x1 = (-b+y)/(2*a);
x2 = (-b+y)/(2*a);
d = &x1;
e = &x2;
}
}
int main()
{
float a, b, c, *d, *e, result1, result2;
printf("Please enter your value for a: ");
scanf("%f", &a);
printf("\nPlease enter your value for b: ");
scanf("%f", &b);
printf("\nPlease enter your value for c: ");
scanf("%f", &c);
QuadFormula(a, b, c);
result1 = *d;
result2 = *e;
printf("\nThe results of the calculation (%.0fx^2 + %.0fx + %.0f) are %f and %f", a, b, c, result1, result2);
}
```

Any help would be appreciated :)

Collin