title: Do I have two strings in my memory, when I assign a string literal to char array
body: <p>This came up in another questions comment</p>
  
  <blockquote>
    <p>String literals have static storage duration (see standard 6.4.5/6). – Jean-Baptiste Yunès</p>
  </blockquote>
  
  <p>And I didn't want to hijack the comment section for this.
  So the question is when I do this:</p>
  
  <p><code>char arr[10] = "Hello";</code></p>
  
  <p>Do I actually have two strings in my memory?
  One at <code>arr</code> until my scope ends (auto duration)
  and one at the point where ever the literal was created until the program closes (static duration)</p>
  
  <p>Would this be equivalent to this:</p>
  
  <pre><code>char* str = "Hello";
  char arr[10];
  memcpy(arr,str,6);
  </code></pre>
  
  <p>If this is true, then I want to make sure what happens with
  <code>char a = 'a';</code></p>
  
  <p>Does this also have double allocation? I would have guessed <code>'a'</code> would be written directly to <code>a</code></p>
  
  <p>Resulting in my last question  would this be more memory efficient?</p>
  
  <p><code>char arr[10] =  { 'H', 'e', 'l', 'l', 'o', '\0'}</code></p>