title: Reassigning string literals
body: <p>This is a really basic question but I did not find a clear answer. I try to understand how string literals in <code>C</code> work.</p>
  
  <pre><code>#define _GNU_SOURCE
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(void)
  {
          char *str = "Hello World!";
          str = "Reassign str.";
  
          char *str2 = "Something.";
  
          str = strdup(str2);
  
          free(str);
  
          exit(EXIT_SUCCESS);
  }
  </code></pre>
  
  <p>When I do <code>str = "Reassign str."</code> or <code>str = strdup(str2)</code> to a string literal what happens to the <code>Hello World</code> string? Is it part of the executable, does it go out of scope, is it's memory freed after I reassign <code>str</code>?</p>