title: strncpy char string issue when deleting the array
body: <p>I don't know, problem with this error. However, I think I should delete <code>uName[]</code> before I delete the <code>[]cpp</code>. How can I do for this?</p>
  
  <pre><code>#define _CRT_SECURE_NO_WARNINGS 1
  #include &lt;iostream&gt;
  #include &lt;string.h&gt;
  
  using namespace std;
  class cppUr
  {
  public:
      void writeName(char nm[]);
      char * readName();
  
  private:
      char uName[80];
  };
  void cppUr::writeName(char nm[])
  {
      strncpy(uName, nm, 79);
  }
  char * cppUr::readName()
  {
      return uName;
  }
  </code></pre>
  
  <p>The main is:</p>
  
  <pre><code>int main()
  {
      char name0[100];
      char name1[100];
      char name2[100];
      char name3[100];
      cppUr *cpp = new cppUr[3];
      cout &lt;&lt; "Input first name: "&lt;&lt;endl;
      cin.getline(name0, 100);
      cpp[0].writeName(name0);
      cout &lt;&lt; "Input second name: " &lt;&lt; endl;
      cin.getline(name1, 100);
      cpp[1].writeName(name1);
      cout &lt;&lt; "Input third name: " &lt;&lt; endl;
      cin.getline(name2, 100);
      cpp[2].writeName(name2);
      cout &lt;&lt; "Input fourth name: " &lt;&lt; endl;
      cin.getline(name3, 100);
      cpp[3].writeName(name3);
      for (int i = 0; i &lt; 4; i++)
      {
          cpp[i].readName();
          cout &lt;&lt; "The "&lt;&lt;i&lt;&lt;" name " &lt;&lt; cpp[i].readName() &lt;&lt; endl;
      }
      delete[] cpp;
      system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <blockquote>
    <p>HEAP CORRUPTION DETECTED: after Normal block(#148) at 0x0059E1E0.
    CRT detected that the application wrote to memory after end of heap buffer</p>
  </blockquote>