I have allocated a two dimensional array using the following code:
// Dynamic allocation
int **matrix=new int*[n];
for(int i=0;i
"What is the correct way of doing it?"
Using standard containers like e.g. std::vector or std::array (supposed N is already known at compile time) is the correct way.
You don't use new()/new[] and delete/delete[] in 1st place (besides rare valid use cases).
If you're sure you have such case, you delete in exactly the reverse order as you were allocating using new[]. delete [][]; isn't valid syntax, as the compiler already told you.