Conformant Arrays in C

Roy Smith roy at phri.UUCP
Sun Feb 21 04:49:04 AEST 1988


	I'm not sure I follow all the details of David's note, but I
thought I would throw in my suggestion anyway.  Some time ago I had need
for variable-dimension arrays in C.  What I ended up using was vectored
arrays.  I wrote an array allocator which called malloc to get memory for
the main array and for the row address vector, and which initialized the
vector to point to the right places in the main array.  After that, you
could pretend you had a variable dimensional array; i.e. you could pass a
subroutine the pointer returned by arrayalloc and the dimensions you used.
It was posted a few years back to mod.sources.
-- 
Roy Smith, {allegra,cmcl2,philabs}!phri!roy
System Administrator, Public Health Research Institute
455 First Avenue, New York, NY 10016



More information about the Comp.lang.c mailing list