I'm trying to use the GNU Scientific Library and am having trouble understanding its documentation. Here's the sample program from the page on gsl_rng_env_setup:
#include <stdio.h>
#include <gsl/gsl_rng.h>
gsl_rng * r; /* global generator */
int
main (void)
{
const gsl_rng_type * T;
gsl_rng_env_setup();
T = gsl_rng_default;
r = gsl_rng_alloc (T);
printf ("generator type: %s\n", gsl_rng_name (r));
printf ("seed = %lu\n", gsl_rng_default_seed);
printf ("first value = %lu\n", gsl_rng_get (r));
gsl_rng_free (r);
return 0;
}
My problems start with the third line, gsl_rng * r. This is clearly not multiplication (neither variable defined yet), so it must be pointer notation. However from the C++ tutorial on pointers, I would expect something like gsl_rng = *r, which would take the value of r and store that as gsl_rng. My guess is that gsl_rng isn't a variable, but some GNU Scientific library command; however I don't understand the documentation page for it also: this command is clearly not of the form gsl_rng * gsl_rng_alloc (const gsl_rng_type * T) - even if r = gsl_rng_alloc, this command doesn't have brackets.
It doesn't help that a bit further down we have the line const gsl_rng_type * T which is of the same form but also clearly does something different. This line seems to be defining gsl_rng_type as a constant, and assigning it the value of *T - but this is missing an assignment operator. Yet T must be a variable, since a few lines later it's assigned the value of gsl_rng_default ...
My problems seem to be extremely basic which is troubling. Can anyone point me in the right direction?