title: Detect when scanf got no input
body: <p>I'm new to C and couldn't have the answer after some research.</p>
  
  <p>I have a while loop that I want to terminate if I input nothing (hit enter) to scanf(). The below doesn't work...</p>
  
  <pre><code>int data;
  while(1){
      scanf("%d", &amp;data);
      if data == NULL{
          break;
      }
  }
  </code></pre>