title: Why gets() function skips when preceded by scanf("%d")?
body: <p>I want to make a program which take Roll No and Full name as input and simply display it 
  My code is . this code skip scaning value of n through gets function. Why this error occur and how to over come this?</p>
  
  <pre><code> #include&lt;stdio.h&gt;
   #include&lt;conio.h&gt;
   void main()
   {
   int r;
   char n[30];
   printf("enter your roll no");
   scanf("%d",&amp;r);
   printf("enter your full name");
   gets(n);
   printf("roll no is %d ",r);
   printf("name is %s ",n);
   getch();
   }
  </code></pre>
  
  <p>while the below code scan the first gets value and skips the second one.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  void main()
  {
   int r;
   char n[30], f[30];
   printf("enter your roll no");
   scanf("%d",&amp;r);
   printf("enter your full name");
   gets(n);
   printf("enter your full name of your father ");
   gets(f);
   printf("roll no is %d ",r);
   printf("name is %s ",n);
   printf("father name is %s ",f);
   getch();
   }
  </code></pre>