HOW I CALCULATE TIME IN C PROGRAM

If you want to get the execution time of your program, you can do this:

//some code
#include <time.h>

int main () { 
    double seconds;
    time_t started=time(NULL);
    RunSomeFunc();
    seconds=difftime(time(NULL),started);
    //more code
}

Here you’re measuring the execution time of RunSomeFunc.


Docs

Leave a Comment