I used to work with C and have a set of libraries which allocate
multi-dimensional arrays(2 and 3) with single malloc call.
data_type **myarray
= (data_type**)ma lloc(widht*heig ht*sizeof(data_ type)+ height*
sizeof(data_typ e*));
//allocate individual addresses for row pointers.
Now that I am moving to C++,am looking for something by which I can
allocate a
multi-dimensional array with one (and only one) 'new' call.
Does my old libraries (with malloc calls) work in C++.Yes.
Then why do I want to use 'new'.Some books encourage usage of new to
malloc(I assume new is much safer than malloc). Anyways,can this be
done?Has anybody done it ?
Thanks,in advance, for all your help.
Ram
multi-dimensional arrays(2 and 3) with single malloc call.
data_type **myarray
= (data_type**)ma lloc(widht*heig ht*sizeof(data_ type)+ height*
sizeof(data_typ e*));
//allocate individual addresses for row pointers.
Now that I am moving to C++,am looking for something by which I can
allocate a
multi-dimensional array with one (and only one) 'new' call.
Does my old libraries (with malloc calls) work in C++.Yes.
Then why do I want to use 'new'.Some books encourage usage of new to
malloc(I assume new is much safer than malloc). Anyways,can this be
done?Has anybody done it ?
Thanks,in advance, for all your help.
Ram
Comment