Listing 2 Header file for dyn2darr.c

/* DYN2DARR.H */

/*  Copyright 1993 by P. J. LaBrocca
   All rights reserved.
   
   Use with Microsoft C versions 6, 7 & 8 (MS-DOS)
   and Symantec THINK C 5 (Macintosh).
*/

#ifndef DYN2DARR
#define DYN2DARR

#include <stdlib.h> /* for free() */

#define Dyn2dArray(r,c,t) (dyn2darray((unsigned) (r), \
                         (unsigned) (c), sizeof(t) ))
#define Dyn2dRows(A) (*((unsigned *) A[0] - 2))
#define Dyn2dCols(A) (*((unsigned *) A[0] - 1))

#if 0
/* Might not be what you need. */
#define Dyn2dSizeOf(A) ( (*((unsigned *) A[0] - 2)) * \
                     (*((unsigned *) A[0] - 1)) * \
                     sizeof( **A ) )
#endif

/* Prototype */
void **dyn2darray( unsigned row, unsigned col, unsigned el_size );

#endif DYN2DARR

/* End of File */