title: By default, reading which character in the input buffer makes scanf() stop reading a string?
body: <p>When I do not use any scanset or a negated scanset, encountering which character in the buffer will make <code>scanf()</code> stop reading data from the buffer (assuming that the character array is large enough)? It seemed as if the answer is a blank because if we enter a multi-worded sentence in the output, then by default <code>scanf()</code> stores only the first word but when i run this code:</p>
  
  <pre><code>int main(void) {  
      char n[20];
      int status;
      do {
          status = scanf("%[^ ]", n);
          //status = scanf("%s", n);
          printf("%d %s\n", status, n);
      } while (status);
      return 0;
  }
  </code></pre>
  
  <p>and enter <code>hello world</code> as the input and press the return key, the output is:</p>
  
  <pre><code>1 hello
  0 hello
  </code></pre>
  
  <p>and when I change the <code>do</code>-<code>while</code> to:</p>
  
  <pre><code> do {
      //status = scanf("%[^ ]", n);
      status = scanf("%s", n);
      printf("%d %s\n", status, n);
  } while (status);
  </code></pre>
  
  <p>I get this as the output (for the same input):</p>
  
  <pre><code>1 hello
  1 world
  </code></pre>
  
  <p>and the program failed to terminate on its own</p>
  
  <p>Again, for the first <code>do</code>-<code>while</code>, if I enter <code>hello</code> and press enter, I do not get any output and program doesn't terminate (obviously because it read no space). But this is not the case for the second <code>do</code>-<code>while</code>.</p>
  
  <p>Also it would be great if someone could answer how do I change my code to make it terminate upon pressing the return key, all the while storing one word at a time.</p>