I\'m investigating a memory leak and from what I see, the problem looks like this:
int main(){
char *cp = 0;
func(cp);
//code
delete[] cp;
}
voi
The parameter cp is a local variable of the function - changing it does not alter anything outside the function. A better way to write the function is:
char * func(){
return new char[100];
}
And not to do directly with your question, but you should probably be using std::string and std::vector rather than dynamically allocated arrays.