Constructor help with const C-string array
<p>I have a simple class Name:</p>

<pre><code>   class Name
{ private:
    char nameStr[30];
  public:
    Name(const char * = "");
    char * getName() const;
    void print() const;
};
</code></pre>

<p>I am having two problems, which are just a bit difficult for me wrap my head around. The constructor is supposed to take an argument of <code>const char *</code> and copy that into the nameStr array. However, this is what I have tried and is not working:</p>

<pre><code>Name::Name(const char * setName)
{
    &amp;nameStr = setName;
}
</code></pre>

<p>It gives me the error "invalid lvalue in assignment". If I remove the reference in front of nameStr, it still errors, saying "incompatible types in assignment of 'const char*' to 'char[30]'". Not quite sure what I'm missing.</p>

<p>The other problem is the accessor method:</p>

<pre><code>char * Name::getName() const
{
    return  &amp;nameStr[0];
}
</code></pre>

<p>I have the same problem, it errors "invalid conversion from 'const char*' to char*'" and I can't for the life of me figure out how to make it return a pointer to a const char... I've been searching to avail. Found plenty of info on const, but can't quite figure how to apply it to my situation. Any help would be greatly appreciated!</p>
