title: Reading newline from previous input when reading from keyboard with scanf()
body: <p>This was supposed to be very simple, but I'm having trouble to read successive inputs from the keyboard.</p>
  
  <p>Here's the code:  </p>
  
  <pre><code>#include &lt;string.h&gt;
  #include &lt;stdio.h&gt;
  
  int main()
  {
      char string[200];
      char character;
      printf ("write something: ");
      scanf ("%s", string);
      printf ("%s", string);
      printf ("\nwrite a character: ");
      scanf ("%c", &amp;character);
      printf ("\nCharacter %c  Correspondent number: %d\n", character, character);
  
      return 0;
  }
  </code></pre>
  
  <p><strong>What is happening</strong></p>
  
  <p>When I enter a string (e.g.: computer), the program reads the newline (<code>'\n'</code>) and puts it in <code>character</code>. Here is how the display looks like:</p>
  
  <pre><code> write something: computer
   computer
   Character:
      Correspondent number: 10
  </code></pre>
  
  <p>Moreover, the program does not work for strings with more than one word.
  How could I overcome these problems? </p>