title: C char pointer with/without malloc
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(void) 
  {
      const char *str = "This is a string";
      char *strCpy = strdup(str); // new copy with malloc in background
  
      printf("str: %s strCpy: %s\n", str, strCpy);
      free(strCpy);
  
      char *anotherStr = "This is another string";
      printf("anotherStr: %s\n", anotherStr);
  
      char *dynamicStr = malloc(sizeof(char) * 32);
      memcpy(dynamicStr, "test", 4+1); // length + '\0'
      printf("dynamicStr: %s\n", dynamicStr);
      free(dynamicStr);
  
      return 0;
  }
  </code></pre>
  
  <p>Why is the definition of <code>anotherStr</code> without malloc also possible, and what are the differences between <code>anotherStr</code> and <code>dynamicStr</code>?</p>