title: Detecting new line in C
body: <p>My code goes something like this:</p>
  
  <pre><code>char k[1000];
  while(1){
  scanf("%s",&amp;k);
      if(k[0] == '\n'){
      exit(0);}
  /* Do some processing on k */
  memset(k,0,1000);
  }
  </code></pre>
  
  <p>My intention is to process user input per normal and terminate when user inputs empty string or new line. This doesn't seem to work.</p>
  
  <p>Could you guys help on what went wrong?</p>
  
  <p>On related note, I also want to terminate if it is the end of file, how should I do it for EoF?</p>
  
  <p>Thank you in advance for all the help.</p>