title: Make a copy of a char*
body: <p>I have a function that accepts a char* as one of its parameters.  I need to manipulate it, but leave the original char* intact.  Essentially, I want to create a working copy of this char*.  It seems like this should be easy, but I am really struggling.</p>
  
  <p>My first (naive) attempt was to create another char* and set it equal to the original:</p>
  
  <pre><code>char* linkCopy = link;
  </code></pre>
  
  <p>This doesn't work, of course, because all I did was cause them to point to the same place.</p>
  
  <p>Should I use strncpy to accomplish this?</p>
  
  <p>I have tried the following, but it causes a crash:</p>
  
  <pre><code>char linkCopy[sizeof(link)] = strncpy(linkCopy, link, sizeof(link));
  </code></pre>
  
  <p>Am I missing something obvious...?</p>
  
  <p>EDIT:  My apologies, I was trying to simplify the examples, but I left some of the longer variable names in the second example.  Fixed.</p>