I've tried using delete[] but my MSVC6 compiler says it's not a pointer. Is there another solution to delete string variables (let's say using string.h).
Printable View
I've tried using delete[] but my MSVC6 compiler says it's not a pointer. Is there another solution to delete string variables (let's say using string.h).
You only need to use delete if you have defined your string var. as a dynamic pointer.
eg.
by the sounds of it you haven't, so remove the delete code.Code:
string *myStringOne;
string *myStringTwo;
myStringOne = new string;
myStringTwo = new string[999];
// deleting at a later stage
delete myStringOne;
delete [] myStringTwo;