title: strcpy function to copy string
body: <p>I am trying to copy a string from an array of strings to another string variable using <code>strcpy</code>... What is the mistake here? Why is the output wrong?</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void main() {
      int i;
      char cw[3][12];
      for (i = 0; i &lt; 3; i++)
          scanf(&quot;%s&quot;, &amp;cw[i]);
      
      puts(cw[2]);
      char ch[12] = &quot;hftiuh&quot;;
      puts(ch);
      strcpy(ch, cw[2]);
      puts(ch[12]);
  }
  </code></pre>
  <p>input</p>
  <pre><code>hello
  again 
  there
  </code></pre>
  <p>this gives output</p>
  <pre><code>there
  hftiuh
  </code></pre>
  <p>expected output</p>
  <pre><code>there
  hftiuh
  there
  </code></pre>