```/* nag_quad_1d_gauss_wgen (d01tcc) Example Program.
*
* NAGPRODCODE Version.
*
* Copyright 2016 Numerical Algorithms Group.
*
* Mark 26, 2016.
*/

#include <stdio.h>
#include <nag.h>
#include <nag_stdlib.h>
#include <nagd01.h>

int main(void)
{
Integer exit_status = 0;
Integer i, n;
double a, b, c, d;
NagError fail;
double *abscis = 0, *weight = 0;

INIT_FAIL(fail);

/* Skip heading in data file */
scanf("%*[^\n] ");
/* Input a, b, c, d and n */
scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
scanf("%" NAG_IFMT "%*[^\n] ", &n);

if (!(abscis = NAG_ALLOC(n, double)) || !(weight = NAG_ALLOC(n, double)))
{
printf("Allocation failure\n");
exit_status = -1;
goto END;
}

* Calculation of weights and abscissae for
* Gaussian quadrature rules, general choice of rule.
*/
if (fail.code != NE_NOERROR) {
exit_status = 1;
goto END;
}

printf("\nLaguerre formula, %3" NAG_IFMT " points\n\n"
"    Abscissae        Weights\n\n", n);
for (i = 0; i < n; i++) {
printf("%15.5e", abscis[i]);
printf("%15.5e\n", weight[i]);
}
printf("\n");

END:
NAG_FREE(abscis);
NAG_FREE(weight);

return exit_status;
}
```