Good day !

I have a problem here. I got a function call normalSearch to perform a linear search on an array. I wish to time the duration taken for the searching process. So I coded my program this way:

clock_t timeStart, timeEnd;
timeStart = clock();
searchResult = normalSearch(searchString, testArray);
timeEnd = clock();
timeUsed = (double)(timeEnd-timeStart)/CLK_TCK;

I thought it should return the timeUsed in the format of x.xx.
But weirdly enough, what I got is that, the timeStart is equal timeEnd ? That means the timeUsed is 0 ?

I have tried with 100000 elements but the result still the same.

How should I modify the function so that it can calculate the time correctly ?

Thanks a lot !

SonicWave