IMSL C Math Library
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 imsl_free. To return the array in memory allocated by the calling program, use the optional argument
IMSL_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, in many functions in “Linear Systems,” the optional arguments
IMSL_INVERSE_USER, float inva[]   (Output)
IMSL_INVERSE, float **p_inva   (Output)
specify two mutually exclusive optional arguments. If the first option is chosen, the inverse of the matrix is stored in the user-provided array inva.
In the second option, float **p_inva refers to the address of a pointer to the inverse. The called function allocates memory for the array and sets *p_inva to point to this memory. Typically, float *p_inva is declared, &p_inva is used as an argument to this function. Use imsl_free(p_inva) to release the space.