Monthly Archives: February 2013

How to measure time taken by a function in C?

                  To calculate time taken by a process, we can use clock() function which is available time.h. We can call the clock function

at the beginning and end of the code for which we measure time, subtract the values, and then divide by CLOCKS_PER_SEC (the number of clock ticks per second) to get processor time, like following. Continue reading