title: User input getting skipped
body: <p>I want to get input for three different variables of a structure but every time one or the other user input gets skipped. I am new to programming and I don't know what is going on. Please help me to understand the problem here.
  I've tried to search for a solution to this problem but couldn't figure it out myself.</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  struct details
  {
      char name[50];
      char license[30];
      char route[120];
      int km;
  } driver1, driver2, driver3;
  
  int main()
  {
      printf(&quot;Driver 1\n&quot;);
      printf(&quot;Name: &quot;);
      scanf(&quot;%s&quot;, &amp;driver1.name);
      printf(&quot;License Number: &quot;);
      scanf(&quot;%s&quot;, &amp;driver1.license);
      printf(&quot;Route: &quot;);
      scanf(&quot;%s&quot;, &amp;driver1.route);
      printf(&quot;Approx km driven: &quot;);
      scanf(&quot;%d&quot;, &amp;driver1.km);
      printf(&quot;\n&quot;);
  
      printf(&quot;Driver 2\n&quot;);
      printf(&quot;Name: &quot;);
      scanf(&quot;%s&quot;, &amp;driver2.name);
      printf(&quot;License Number: &quot;);
      scanf(&quot;%s&quot;, &amp;driver2.license);
      printf(&quot;Route: &quot;);
      scanf(&quot;%s&quot;, &amp;driver2.route);
      printf(&quot;Approx km driven: &quot;);
      scanf(&quot;%d&quot;, &amp;driver2.km);
      printf(&quot;\n&quot;);
  
      printf(&quot;Driver 3\n&quot;);
      printf(&quot;Name: &quot;);
      scanf(&quot;%s&quot;, &amp;driver3.name);
      printf(&quot;License Number: &quot;);
      scanf(&quot;%s&quot;, &amp;driver3.license);
      printf(&quot;Route: &quot;);
      scanf(&quot;%s&quot;, &amp;driver3.route);
      printf(&quot;Approx km driven: &quot;);
      scanf(&quot;%d&quot;, &amp;driver3.km);
      printf(&quot;\n&quot;);
  
      printf(&quot;Driver 1 details:\n&quot;);
      printf(&quot; Name: %s\n&quot;, driver1.name);
      printf(&quot; License number: %s\n&quot;, driver1.license);
      printf(&quot; Route: %s\n&quot;, driver1.route);
      printf(&quot; Apprrox km driven: %d&quot;, driver1.km);
      printf(&quot;\n&quot;);
  
      printf(&quot;Driver 2 details:\n&quot;);
      printf(&quot; Name: %s\n&quot;, driver2.name);
      printf(&quot; License number: %s\n&quot;, driver2.license);
      printf(&quot; Route: %s\n&quot;, driver2.route);
      printf(&quot; Apprrox km driven: %d&quot;, driver2.km);
      printf(&quot;\n&quot;);
  
      printf(&quot;Driver 3 details:\n&quot;);
      printf(&quot; Name: %s\n&quot;, driver3.name);
      printf(&quot; License number: %s\n&quot;, driver3.license);
      printf(&quot; Route: %s\n&quot;, driver3.route);
      printf(&quot; Apprrox km driven: %d&quot;, driver3.km);
      printf(&quot;\n&quot;);
  
      return 0;
  }
  </code></pre>