title: strcpy() and arrays of strings
body: <p>I need to store the input from a user into an array of strings.</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  char *history[10] = {0};
  
  int main (void) {
  
      char input[256];
  
      input = "input";
  
      strcpy(history[0], input);
  
      return (EXIT_SUCCESS);
  
  }
  </code></pre>
  
  <p>Running it on the terminal I get a Segmentation Fault and in NetBeans I get main.c:11: error: incompatible types in assignment. I also tried to shift all the history to store the newest input into the first position (history[0]).</p>
  
  <pre><code>history[9] = history[8];
  history[8] = history[7];
  history[7] = history[6];
  history[6] = history[5];
  history[5] = history[4];
  history[4] = history[3];
  history[3] = history[2];
  history[2] = history[1];
  history[1] = history[0];
  history[0] = input;
  </code></pre>
  
  <p>But this causes output like this.</p>
  
  <p>If input is "input"</p>
  
  <p>History 0: input
  History 1: null
  etc.</p>
  
  <p>If then input is "new"</p>
  
  <p>History 0: new
  History 1: new
  History 2: null
  etc.</p>
  
  <p>Each time a new input is entered the pointers to the string shift but it causes only the newest value to be saved in the history array.</p>