Allocation of multidimensional array

Hello,

I would like to make an array of n pointers to arrays of m integers. I see two options for initialization :

- make n new arrays of m integers and store their addresses in the main array
- allocate an array of n*m integers and then dispatch sub-pointers to the main array

The idea behind the second method is to avoid unnecessary calls to new and delete. Is it a good idea ? Is there a canonical method to handle that ?
Last edited on
Topic archived. No new replies allowed.