How can I check if my pointer has allocated memory?
I want to use delete [] on it, but I can't unless I know its already allocated... and a bool won't work well... how can I check a memory address to see if
address = new char[blah]
has been executed?
Thats what I was trying to do.Code:if (operand.charptr != NULL) { cout << "Freed"; delete [] operand.charptr; } if (operand.charptr == NULL) { operand.charptr = new char[strlen(temp)]; strcpy(operand.charptr,temp); }