title: Unable to free const pointers in C
body: <p>How can I free a <code>const char*</code>? I allocated new memory using <code>malloc</code>, and when I'm trying to free it I always receive the error "incompatible pointer type"</p>
  
  <p>The code that causes this is something like:</p>
  
  <pre><code>char* name="Arnold";
  const char* str=(const char*)malloc(strlen(name)+1);
  
  free(str); // error here
  </code></pre>