A
alan
Hi all,
I have a problem on release memory.
If I delcare the following pointer to pointer char, how can I free the
allocated memory ?
let say "myVar = 20" <---actually it is not a constant, but now I set
it to 20.
char **tempStr=(char**)new char[sizeof(char*)*myVar];
...
....do something to set value to each char pointer
...
I try to delete it by the following statement.
for (int i=0; i< myVar; i++)
delete tempStr;
BUT it is violet my program.
Can anybody tell me how to release memory in such case.
Thank you very much.
Alan
I have a problem on release memory.
If I delcare the following pointer to pointer char, how can I free the
allocated memory ?
let say "myVar = 20" <---actually it is not a constant, but now I set
it to 20.
char **tempStr=(char**)new char[sizeof(char*)*myVar];
...
....do something to set value to each char pointer
...
I try to delete it by the following statement.
for (int i=0; i< myVar; i++)
delete tempStr;
BUT it is violet my program.
Can anybody tell me how to release memory in such case.
Thank you very much.
Alan