4 /**************************************************************************
5 * alloc_float_2d - dynamically allocates a two dimensional array
8 * firsdim - the number of elements in the first dimension of the array
9 * seconddim - the number of elements in the second dimension of the array
11 * On success, a newly allocated two-dimensional array
14 ***************************************************************************/
15 float **alloc_float_2d(int firstdim
,int seconddim
)
20 outvar
= (float **)calloc(firstdim
,sizeof(float *));
21 if (outvar
== NULL
) return NULL
;
22 for (row
=0; row
< firstdim
; row
++) {
23 outvar
[row
] = (float *)calloc(seconddim
,sizeof(float));
24 if (outvar
[row
] == NULL
) {
25 for (row2
= 0; row2
< row
; row2
++) {
35 /**************************************************************************
36 * free_float_2d - frees memory held by a two dimensional array
39 * var - the two-dimensional array to be freed
40 * firsdim - the number of elements in the first dimension of the array
41 * seconddim - the number of elements in the second dimension of the array
45 ***************************************************************************/
47 void free_float_2d(float **var
, int firstdim
, int seconddim
)
50 for (row
=0; row
< firstdim
; row
++) {