measure time in c
#include <stdio.h>
#include <time.h>
int main() {
clock_t start, end;
double cpu_time_used;
start = clock();
// Perform the task for which you want to measure time
// For example, a loop to simulate some computation
for (int i = 0; i < 1000000; i++) {
// Do something...
}
end = clock();
cpu_time_used = ((double)(end - start)) / CLOCKS_PER_SEC;
printf("CPU time used: %f seconds.\n", cpu_time_used);
return 0;
}