Which comes first...delete [] or NULL?
I've allocated memory for a pointer with new like this:
Code:
char * szBuffer=new char [256];
I use it several times in the program, rewriting data into it.
When I quit at the end of the program, i get an error. Debug says it happens when i call delete [] on the szBuffer pointer.
currently heres what i do:
Code:
delete [] szBuffer;
szBuffer=NULL;
as i've been told szBuffer is turned to 0 length when NULL is used...but should that be used before or after delete?
thanks for your help.