hi,

Can any one help me about clock problem..i need to calculate the exact execution time of algorithm using the processor clock speed not the wall clock time..i am getting zero by using the clock_t function in time.h.also how can i calculate the exact processor speed execution of program..reply me as soon as possible.

for example
#include<stdio.h>
#include<time.h>
int main()
{
clock_t start,end;
start=clock();
bubblesort(array,arraysize);
end=clock();
printf("the clock speed: %f",start-end);
getch();

}

your code: " printf("the clock speed: %f",start-end); "

Hey dude, change to: end - start to obtain time in miliseconds
or (end - start) / 1000.0 for time in seconds.miliseconds

(and don't forget to declare double start, end; ) ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.