I have used:
Code:
clock_t start;
start = clock();
in one of my functions.
I then use the same again in a different function, but in the second function I get an error:
Code:
Local variable 'start' is initialised but never used
yet if I remove the line clock_t start in my second function, I then get an error saying that start is an undeclared identifier.
Here is the part of the second function:
Code:
clock_t start;
start = clock();
for (tmp = list; tmp != NULL; tmp = tmp->next)
{
total += tmp->num;
}
for (tmp = list; tmp != NULL; tmp = tmp->next)
{
if (strcmp(tmp ->word, query) == 0) { printf("\n'"; }
}
(double)(clock() - start) / CLOCKS_PER_SEC;
Since the code for the clock with copied and pasted from my previous bit of code, I am very surprised it is not working.
Why is this wrong, and what can I do to fix it?