title: Where to free up memory of a dynamic array created inside a function
body: <p>This is in reference to the discussion in this topic here
  <a href="https://stackoverflow.com/questions/1217173/how-to-have-a-char-pointer-as-an-out-parameter-for-c-function">How to have a char pointer as an out parameter for C++ function</a></p>
  
  <p>In the code below, where do I free the memory of <strong>pTemp</strong>? Is it not required?
  Would things would have changed in anyway if instead of array of chars there was array of integers?</p>
  
  <pre><code>void SetName( char **pszStr )
  {
      char* pTemp = new char[10];
      strcpy(pTemp,"Mark");
      *pszStr = pTemp;
  }
  
  int main(int argc, char* argv[])
  {
      char* pszName = NULL;
      SetName( &amp;pszName );
      cout&lt;&lt;"Name - "&lt;&lt; pszName &lt;&lt; endl;
      delete [] pszName;
      cin.get();
      return 0;
  }
  </code></pre>