title: How to measure scanf time in a C program?
body: <p>In the following program, I want to measure the input time i.e. the time taken by user to enter the variables of the array :    </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  
  int main()
  {
      int i, array[10];
      double user_input_time;
      clock_t input_start, input_end;
  
      input_start = clock();
  
      for (i = 0; i &lt; 10; i++)
      {
          scanf("%d", &amp;array[i]);
      }
  
      input_end = clock();
  
      user_input_time = ((double)(input_end - input_start)) / CLOCKS_PER_SEC;
  
      printf("User Input Time : %f\n", user_input_time);
  
      return 0;
   }
  </code></pre>
  
  <p>Above, what I'm getting is the processor time taken not the input time taken by user to enter all the 10 variable of the array.</p>
  
  <p>Please, can someone help me in doing so.</p>