I'm using the following
char** m_pcPuzzle;

to create an array for to store a crossword puzzle. I allocate memory using the next few lines

//allocate memory for new map
m_pcPuzzle=new char*[m_iWidth];

for (int x=0;x<rhs.m_iWidth;x++)
        m_pcPuzzle[x]=new char[m_iHeight];


What is the correct way for me to call delete?

Should I just do

for (int x=0;x<m_iWidth;x++)
        delete m_pcPuzzle[x];

        delete [] m_pcPuzzle;

Am I allocating the memory correctly?

Thanks,
Thomas


_______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to