title: C structure not scanning all the inputs
body: <p>I have this C code:  </p>
  
  <pre><code>#include "stdio.h"
  
  main()
  {
      struct books
      {
          char name[100],author[100];
          int year,copies;
      }book1,book2;
  
      printf("Enter details of first book\n");
      gets(book1.name);
      gets(book1.author);
      scanf("%d%d",&amp;book1.year,&amp;book1.copies);
  
      printf("Enter details for second book\n");
      gets(book2.name);
      gets(book2.author);
      scanf("%d%d",&amp;book2.year,&amp;book2.copies);
  
      printf("%s\n%s\n%d\n%d\n",book1.name,book1.author,book1.year,book1.copies);
      printf("%s\n%s\n%d\n%d\n",book2.name,book2.author,book2.year,book2.copies);  
  }  
  </code></pre>
  
  <p>What is happening here is that it only scans till the author name of the second book. After that it directly prints the output.  </p>
  
  <p>Here is my <strong>input</strong>:(The first two lines are the initial printf statements)  </p>
  
  <pre><code>Enter details of first book
  warning: this program uses gets(), which is unsafe.
  the c programmign laguagne
  dfadsda
  3432
  23
  Enter details for second book
  ruby on rails
  mark hammers  
  </code></pre>
  
  <p>After which it directly <strong>prints the output</strong>:  </p>
  
  <pre><code>the c programmign laguagne
  dfadsda
  3432
  23
  
  ruby on rails
  0
  0
  </code></pre>
  
  <p>What is wrong here? Also we can see that the name of the second book is assinged to the author.  </p>
  
  <p>I'm using <code>gcc</code> as the compiler on Mac OS X ML.</p>