title: Segmentation Fault when I add a for Loop
body: <p>When I add the for loop I get segmentation fault. Also, when I add buffer[i] !='\0' in the while loop condition, I get segmentation fault error. I am having a hard time trying to understand why this error pops up. Thanks.</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;string.h&gt;
   #include &lt;stdlib.h&gt;
  
  int main()
  {
      char buffer[2000] = "-rw-r--r-- 1 ftp ftp 614400 Oct 18  2006\r\n"
      char String[2000];
      int i, j, k= 0;
      int nextline= 0;
  
     for(k = 0; k&lt;strlen(buffer);k++)
      {
          while((buffer[i] != '\r' &amp;&amp; buffer[i+1] != '\n'))
           {
             String[j] = buffer[i];
             i++;
             j++;
           }
  
     }
    printf("%s", String);               
  }
  </code></pre>