title: interesting behaviour when using scanf on string with space in a loop
body: <p>I was fiddling with C and happen to wrote code below. When I input a string with spaces, program receives all of the input but outputs them as if they were inputted as single words at different times. I thought scanf stopped when first whitespace character is encounterd and ignored the rest. But that seems, is not the case.</p>
  
  <p>I included the output when I enter "inputWithNoSpaces" and "input with spaces", below.</p>
  
  <p>I tried to look into stdin. It receives all the input. But I could not figure out what scanf was doing. I would like to learn what is happening.</p>
  
  <p>Code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int i=0;
      char word[64]="";
  
      while(1)
      {
          printf("enter string:");
          scanf("%s",word);
          i++;
          printf("%d:%s\n\n",i,word);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>enter string:inputWithNoSpaces
  1:inputWithNoSpaces
  
  enter string:input with spaces
  2:input
  
  enter string:3:with
  
  enter string:4:spaces
  
  enter string:
  </code></pre>