title: Reading sentences results in delaying the "for" by one step?
body: <p>I've tried using this code to read the struct named packet, which includes priority(int), qty(float) and message (a sentence).</p>
  
  <pre><code>for(i = 0; i &lt; 3; i++) {
    scanf("%d%f", &amp;packet[i].priority, &amp;packet[i].qty);
    gets(packet[i].message);
    printf("\n%d %.6f ", packet[i].priority, packet[i].qty);
    printf("%s\n", packet[i].message);
  }
  </code></pre>
  
  <p>The problem is that I want it to print something like:</p>
  
  <pre><code>1 1 MESSAGE NUMBER ONE
  2 1 MESSAGE NUM TWO 
  3 4 MESS NO THREE
  </code></pre>
  
  <p>But instead it prints</p>
  
  <pre><code>1 1 
  0 0 MESSAGE NUMBER ONE
  2 1
  </code></pre>
  
  <p>Like the gets() doesn't execute when needed but instead delays the "for" by one step. Any ideas?</p>