I am trying to time how long it takes for a program to execute
the program below is working but I am not sure whether it is doing what it's suppsose to do.
I never used system() so I am not sure whether I used it correctly in here. The program that I am timing is called flotlim.exe
Also do I have to put the codes for flotlim in this programs or just writting system("flotlim.exe") is enough?
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
int main(void)
int k,n;
double elapsed;
clock_t start_time, end_time;
start_time=clock();
system("flotlim.exe");
for (n=0;n<5000; n++) for(k=0;k<5000;k++);
end_time=clock();
elapsed=difftime(end_time, start_time)/(double)CLOCKS_PER_SEC;
printf("%ld %ld\n", start_time, end_time);
printf("%f %f\n", start_time/CLOCKS_PER_SEC,end_time/CLOCKS_PER_SEC);
printf("%3.1lf%s\n", elapsed, "seconds");
return 0;
}