The difference between delete and delete [] in C++
- by Ilya Melamed
I've written a class that contains two pointers, one is char* color_ and one in vertexesset* vertex_ where vertexesset is a class I created. In the destractor I've written at start
delete [] color_;
delete [] vertex_;
When It came to the destructor it gave me a segmentation fault.
Then I changed the destructor to:
delete [] color_;
delete vertex_;
And now it works fine. What is the difference between the two?