If you apply "delete" instead of "delete[]" to an array in C++, then you will create a memory leak because only the first element will be deleted. But what happens if you apply "delete[]" to a non-array pointer by accident? For instance (just a toy example):
class X {
void foo()
{
X* x = new X();
delete[] x; // What happens here?
}
};
Can it do any harm? And if so, what harm?