title: Modifying a char array inside a function in C
body: <p>So I've been playing around with C lately and have been trying to understand the intricacies of passing by value/reference and the ability to manipulate a passed-in variable inside a function. I've hit a road block, however, with the following:</p>
  
  <pre><code>void modifyCharArray(char *input)
  {
      //change input[0] to 'D'
      input[0] = 'D';
  }
  
  int main()
  {
      char *test = "Bad";
      modifyCharArray(test);
      printf("Bad --&gt; %s\n", test);
  }
  </code></pre>
  
  <p>So the idea was to just modify a char array inside a function, and then print out said array after the modification completed. However, this fails, since all I'm doing is modifying the value of <code>input</code> that is passed in and not the actual memory address.</p>
  
  <p>In short, is there any way I can take in a <code>char *input</code> into a function and modify its original memory address without using something like <code>memcpy</code> from string.h?</p>