title: Why is this wrong?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3638851/why-does-this-seg-fault">Why does this Seg Fault?</a><br>
    <a href="https://stackoverflow.com/questions/9460260/what-is-the-difference-between-char-a-string-and-char-p-string">What is the difference between char a[] = “string”; and char *p = “string”;</a>  </p>
  </blockquote>
  
  
  
  <p>Trying to understand why s[0]='H' fails. I'm guessing this has something to do with the data segment in the process memory but maybe someone better explain this?</p>
  
  <pre><code>void str2 (void) 
  { 
      char *s = "hello"; 
      printf("%s\n", s); 
      s[0] = 'H';          //maybe this is a problem because content in s is constant? 
      printf("%s\n", s); 
  }
  
  int main()
  {
      str2();
      return 0;
  }
  </code></pre>