double *diff;
/*
diff is a pointer to an array */
diff = (double *) calloc(ndat,sizeof(double));
/* the pointer diff is now
to a region with space reserved for ndat double
precision numbers calloc initializes this region to
0*/
diff[i]=fmpoly(xdat,fdatr,fdati,5,i,ndbeg);
/* diff is addressed
henceforth as though it had been dimensioned as
double diff[ndat]; */
/* if there is not enough
space calloc returns NULL */
/* the space is released
with the command
free(diff); */
Start in cbooks.hlp look
for alloca.
#include <stdlib.h> For ANSI
compatibility
void *calloc(
size_t n, size_t size );
Description:
The calloc function allocates space on the Heap for an array of n objects, each of length size bytes. Each element is initialized to 0.
The malloc function does not
initialize the elements to zero.