Question

Hi. I need a little help writing a program. Below is what is the
question and the code that I have started. My main problem with
this code is getting the function to return values back to the main
and using the pointer to load the roots.

Write a function that solves the quadratic equation
ax2 + bx + c = 0. The prototype of the
function should be:

int quadratic(double a, double b, double c, double* r1, double*
r2);

When called, the function should do the following:

If a and b are both 0 it should return 1, indicating that this
is not an equation

If a is 0 and b is not 0, it should return 2, indicating that
this is a linear equation and there is one real root. It
should put the root in *r1.

If the equation has two real roots, it should return 3 and put
the two roots in *r1 and *r2.

If the equation has two complex roots, it should return 4 and
put the real part in *r1 and the imaginary part in *r2. The
roots are (*r1) + j(*r2) and (*r1) – j(*r2)