title: C++ allocating dynamic memory in a function - newbie question
body: <p>I'm investigating a memory leak and from what I see, the problem looks like this:</p>
  
  <pre><code>int main(){
      char *cp = 0;
      func(cp);
      //code
      delete[] cp;
  }
  
  void func(char *cp){
      cp = new char[100];
  }
  </code></pre>
  
  <p>At the //code comment, I expected cp to point to the allocated memory, but it still is a null pointer meaning I never delete the memory.  What am I doing wroing?</p>