Bill Press
03-21-2002, 07:21 PM
Dick Hogaboom of MIT Lincoln Labs has written a flexible dynamic array allocator that does allocation based on the pointer to pointer to ... model necessary for passing arrays or subarrays of arrays into subroutines, modifying them there, and seeing the results in the calling routine. Arrays may be up to ten dimensions (although this is only a #define and may be increased), and each subscript may have a different starting value (0, 1, -1, 5, or anything). A single malloc() does all the space allocation for both pointers and data, thus maintaining locality of reference to minimize paging for large arrays. Any type that can be passed to the sizeof() operator may be allocated.
Dick has consented to make his package available in the Numerical Recipes User Contributions area at http://www.nr.com/contrib/
Please read the Terms of Use before you download or use any of this material and note its copyright.
Dick has consented to make his package available in the Numerical Recipes User Contributions area at http://www.nr.com/contrib/
Please read the Terms of Use before you download or use any of this material and note its copyright.