title: C-String array initialization - is this mutable?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/480555/modifying-c-string-constants">Modifying C string constants?</a><br>
    <a href="https://stackoverflow.com/questions/9393291/pointer-to-const-char-vs-char-array-vs-stdstring">Pointer to const char vs char array vs std::string</a>  </p>
  </blockquote>
  
  
  
  <p>I know I'm probably beating the dead horse with this question, but I'm a little confused and I haven't managed to find an exact answer on SO or google (that I'm confident is right - there's just too much information on C-strings to sift through).  Also, I've tagged it C++ because that's what I'm interested in, even though we're talking about C-style strings specifically.</p>
  
  <p>In this situation:</p>
  
  <pre><code>char const a*  = "hello";
  char const b[] = "goodbye";
  </code></pre>
  
  <p>I would have thought that "hello" and "goodbye" were both immutable strings because they come from string-literals that should decay to a char const*.</p>
  
  <p>I've seen that in this particular case though, changing "hello" would be undefined while changing "goodbye" would be fine, assuming you stripped the constness from the b-array.</p>
  
  <p>I assume that the string is mutable in the case of b due to the fact that its stored in a user-defined array.</p>
  
  <p><em>Are hello and goodbye different in this case?</em>  Is goodbye not a string-literal for some reason given this example.  Also, if goodbye isn't a string-literal, can I assume it isn't held in global memory, and the only reference to it after compile time is that which is left in the user-array cells?</p>