title: Assign a char array class member using string literal
body: <p>If I create my class like this:</p>
  <pre class="lang-cpp prettyprint-override"><code>class MyCLass {
  private:
      char name[25]{};
  public:
      MyClass();
      MyClass(char name[]);
  };
  </code></pre>
  <pre class="lang-cpp prettyprint-override"><code>MyClass::MyCLass() {
      stringCopy(&quot;&quot;, this-&gt;name);
  }
  MyCLass::MyClass(char name[]) {
      stringCopy(name, this-&gt;name);
  }
  </code></pre>
  <p>where <code>stringCopy</code> is a function I made to copy two char arrays, when I create in the <code>main</code> function an object <code>MyClass obj(&quot;John&quot;);</code>, the name is assigned correctly but I get the following warning: <code>ISO C++11 does not allow conversion from string literal to 'char *'</code>, so I asked myself: What is the correct and best way to initialize a char array as a class member?</p>
  <p>First of all, I don't like the way I initialized <code>char name[25]{};</code> but the only alternative would be to use dynamic memory. Is there a better alternative than the two?</p>
  <p>Also, although the message I get after compiling the code is only a warning, I'd rather avoid such potential conflicts in my code. Is there another way to avoid this problem other than creating a char array with the name and then creating an object and passing this new variable as an argument?</p>
  <p>EDIT: I missed that detail: I am required to use a char array. No strings are allowed.</p>