title: Putting user input into char array (C Programming)
body: <p>I need to read the input from the console and put it into an array of chars. I wrote the following code, but I get the following error: "Segmentation Fault"</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main() {
  
      char c;
      int count;
      char arr[50];
  
      c = getchar();
      count = 0;
      while(c != EOF){
          arr[count] = c;
          ++count;
      }
  
  
      return (EXIT_SUCCESS);
  
  }
  </code></pre>