Hi I got some problem with the clock fct.
Why do I get start and end to be equal?Code:#include <time.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
clock_t start, end;
double cpu_time_used;
start = clock();
int i = 0;
for(i= 0;i++;i<500);
end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
printf("start: %e\n", start);
printf("end: %e\n",end);
}
}
And if I add printf("end: %e\n",cpu_time_used); in the end I get start, end and cpu_time_used all equal to zero.
I don't get it! *smash head on the wall*
But when I writeQuote:
In the GNU system, `clock_t' is equivalent to `long int'
Info: (libc.info.gz) Processor And CPU Time
I get start = 0;Code:printf("start: %ld\n", start);
Why is that?