Bioplib
Protein Structure C Library
|
Allocate and free 3D arrays. More...
Go to the source code of this file.
Macros | |
#define | NULL ((void *)0) |
Functions | |
char *** | blArray3D (int size, int dim1, int dim2, int dim3) |
void | blFreeArray3D (char ***array, int dim1, int dim2, int dim3) |
Allocate and free 3D arrays.
This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.
The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.
The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.
Creates a 3D array where the first dimension is a set of pointers. This is better for passing into subroutines than the conventional C method of simply declaring:
TYPE matrix[10][10][10];
which, when passed to a fuunction, loses the concept of dimensions unless the matrix is explicitly defined with these dimension in the function.
This routine creates an array of pointers to 1-D arrays and can thus be passed to functions successfully.
matrix = (TYPE ***)Array3D(sizeof(TYPE), nrows, ncolumns, nplanes);
Returns NULL (having freed any allocated memory) if there is a problem.
Definition in file array3.c.
char*** blArray3D | ( | int | size, |
int | dim1, | ||
int | dim2, | ||
int | dim3 | ||
) |
[in] | size | Size of an array element |
[in] | dim1 | First dimension (number of rows) |
[in] | dim2 | Second dimension (number of columns) |
[in] | dim3 | Third dimension (number of planes) |
Create a 3D array of elements of size `size' with dimensions `dim1' rows by `dim2' columns by `dim3' planes
void blFreeArray3D | ( | char *** | array, |
int | dim1, | ||
int | dim2, | ||
int | dim3 | ||
) |
[in] | array | Array of pointers to be freed |
[in] | dim1 | First dimension (number of rows) |
[in] | dim2 | Second dimension (number of columns) |
[in] | dim3 | Third dimension (number of planes) |
Frees a 3D array with dimensions `dim1' rows by `dim2' columns by `dim3' planes.