I'm using g++ -std=c++11
and this compact approach to allocate/deallocate 2d arrays :
int(*MyArray)[Ydim]=new int[Xdim][Ydim];
delete[] MyArray;
Everything seems to be working fine (compile time and run time). I know there are many ways to do the same but this is compact and seems to be doing the job. Is anything wrong with it?
Everything seems to work...but worried about subtle problems (memory leakage...)
Xdim and Ydim are compile time constants
Aucun commentaire:
Enregistrer un commentaire