Home » How to check run time in c

How to check run time in c

Let’s start the discussion about How to check run time in c in following Approaches.

We can utilise the clock() function, which is available time, to compute the time used by a process. h. At the beginning and finish of the code, we may call the clock function to measure time, subtract the values, and then divide by CLOCKS PER SEC (the number of clock ticks per second) to get processor time, as shown below.


run time in c ?

clock_t begin = clock();

/* here, do your time-consuming job */

clock_t end = clock();
double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
printf("%f\n", time_spent);

I hope the strategies listed above work for you. Happy coding and come back again.

Similar Post : csrf_exempt in Django