title: Dynamically allocating memory to constant char pointer in C?
body: <p>I'm trying to dynamically allocate memory to a char pointer using <code>malloc()</code> but not sure what I'm missing here.</p>
  
  <pre><code>void item(struct product *pr, const char *title, double price)
  {   
    title = malloc((strlen(title)+1) * sizeof(const char));
  }
  </code></pre>
  
  <p>I added the +1 for the <code>/0</code> character, not sure if needed, but didn't work without it either. I assume I don't need to allocate memory for the structs or double.</p>