title: c programming - printing sentences
body: <p>this is my first time using this site as well as learning c programming. 
  I'm trying to write a code which lets a user type in a sentence and the code prints it back out.</p>
  
  <p>My attempt:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      char array[1000];
      printf("Please enter a phrase: ");
      int index = 0;
      while(array[index]!= '\0')
      {
          scanf("%c",&amp;array[index]);
          ++index;
      }
      index = 0;
      while(array[index]!= '\n')
      {
          printf("%c",array[index]);
          ++index;
      }
  }
  </code></pre>
  
  <p>I can't find the reason to why this code does not work.</p>