title: scanf getting two lines inputs with whitespace
body: <p>please find the below code for example </p>
  
  <pre><code>main()
  {
      int i;
      char s[100];
      printf("Enter the string \n");
      scanf(" %s ",s);
      printf("Enter the string\n");
      scanf("%d",&amp;i);
      printf("%s\n%d\n",s,i);
  }
  </code></pre>
  
  <p>The output of above code is</p>
  
  <pre><code>Enter the string 
  hai
  hai
  Enter the string
  hai
  0
  </code></pre>
  
  <p>It supposed to accept one line input but it is accepting second line also.<br>
  If  removed the space in scanf, the output is coming correctly.</p>
  
  <p>Can anyone explain?</p>
  
  <p>when using the same with integer (%d) it is not happening. It is happening with string.</p>