title: scanf() in while loop not terminating?
body: <p>I have a while loop that scans in an input set of integers.  It scans and prints all of the numbers with "..." at the end and skips to the next line.  However, the script does not: execute past the while loop and print TEST.</p>
  
  <p>For example, I enter:
  3 44 62 1</p>
  
  <p>It prints:
  3...</p>
  
  <p>44...</p>
  
  <p>62...</p>
  
  <p>1...</p>
  
  <p>When it should print:
  3...</p>
  
  <p>44...</p>
  
  <p>62...</p>
  
  <p>1...</p>
  
  <p>TEST</p>
  
  <pre><code>while(scanf("%d", &amp;n) != -1) {
      x[i] = n;
      i++;
  
      printf("%d", n);
      printf("...\n");
  }
  
  printf("TEST");
  </code></pre>
  
  <p>What am I doing wrong?</p>