Memory Allocation for Output Arrays
Many functions return a pointer to an array containing the computed answers. By default, an array returned as the value of a C Numerical Library function is stored in memory allocated by that function. To release this space, use imsls_free. To return the array in memory allocated by the calling program, use the optional argument
IMSLS_RETURN_USER, float a[]
In this way, the allocation of space for the computed answers can be made either by the user or internally by the function.
Similarly, other optional arguments specify whether additional computed output arrays are allocated by the user or are to be allocated internally by the function. For example, the optional arguments
IMSLS_ANOVA_TABLE_USER, float anova_table[] (Output)
IMSLS_ANOVA_TABLE, float **p_anova_table (Output)
specify two mutually exclusive optional arguments. If the first option is chosen, the ANOVA table is stored in the user-provided array anova_table.
In the second option, float **p_anova_table refers to the address of a pointer to the ANOVA table. The called function allocates memory for the array and sets *p_anova_table to point to this memory. Typically, float *p_anova_table is declared, &p_anova_table is used as an argument to this function. Use imsls_free(p_anova_table) to release the space.