title: How Terminate scanf() without entring the value?
body: <pre><code>#include "stdio.h"
  main()
  {
      int option;
      printf("Enter the value :");
      scanf("%d",&amp;option);
      printf("Your value is %d\n",option);
  }
  </code></pre>
  
  <p>This is my simple C program to get the value form the user and print it. I have a doubt
  why scanf waits till the values is entered, it does not terminate when \n ie., enter key is pressed. </p>
  
  <p>For example : </p>
  
  <pre><code>16:26:40-$./a.out
    Enter the value: &lt;-|
  &lt;-|
  &lt;-|
  &lt;-|
  &lt;-|
  &lt;-|
  &lt;-|
     1
  Your value is 1
  </code></pre>
  
  <p>I need clear concept and what is the solution for this? </p>
  
  <p>Thanks in Advance</p>