Hi all,

This is a great site. I'm doing the tutorials now, and I ran into a minor hitch:
The delete operator frees up the memory allocated through new. To do so, the syntax is as in the example.

Code:
delete ptr;
After deleting a pointer, it is a good idea to reset it to point to 0.
Deleting the pointer before resetting it to 0 gives me this error:
Debug Assertion Failed!
Expression: _BLOCK_TYPE_IS_VALID(pHead -> nBlockUse)

Resetting the pointer to 0 before I delete it seems to work, but I'm wondering - is there more to this than meets the eye?

code:
Code:
int main()
{
	int pointee = 1010;
	int *pointer = new int;
	cout<<"\nPointee is " << pointee << "";
	pointer = &pointee;
	cout<<"\nPointer is " << pointer << "";
	pointer = 0;
	cout<<"\nPointer is " << pointer << "";
	delete pointer; //if I try deleting pointer before setting it to 0, I get the error 
}