I keep getting an " error: expected primary-expression before 'char' "

I've isolated my code and I've found this is where the problem is coming from - my clear function. I'm currently making a 2D array. I've made a function that allocates memory for the 2D array, however, my function to deallocate the memory isn't working.

1
2
3
4
5
6
7
8
9
 void Puzzle::clear(){

  m_table = delete char*[m_size];

  for(int i = 0; i < m_size; i++){
    m_table[i] = delete char[m_size];
  }

}


I keep tweaking it but I'm not 100% sure what's wrong. I'd appreciate any help, thank you!
Last edited on
It looks like you mean to say this:

1
2
3
4
5
void Puzzle::clear()
{
    for (int i = 0; i < m_size; ++i) delete m_table[i];
    delete m_table;
}

Yes. Thank you very much!
Topic archived. No new replies allowed.