title: How space is interpreted in the format of C scanf?
body: <p>I would like to know how space is interpreted in the format of C scanf.</p>
  
  <p>for example, when I write:</p>
  
  <pre><code>scanf("%d ",&amp;c);
  </code></pre>
  
  <p>the value read from the keyboard is not directly assigned to the variable <code>c</code>.</p>
  
  <p>And if I write:</p>
  
  <pre><code>while(c != 0){
      scanf("%d  ",&amp;c);
      printf("c = %d\n", c);
  }
  </code></pre>
  
  <p>I have to enter <code>0</code> twice to exit the <code>while</code> loop.</p>
  
  <p>Can someone explain this behaviour?</p>
  
  <p>Thanks.</p>