I am trying to write a C program using GSL to find the roots of a cubic equation following the instructions here: http://www.gnu.org/software/gsl/manual/html_node/Cubic-Equations.html. This is what I came up with:
#include <stdio.h>
#include <gsl/gsl_poly.h>
double *x0,*x1,*x2;
int roots;
int
main (void)
{
roots = gsl_poly_solve_cubic(0,0,0,x0,x1,x2);
printf( " %d ", roots);
return 0;
}
The arguments are 0,0,0 because I wanted to test if it works first. The code compiles but when run, it crashes with no output.
What am I doing wrong?