//To calculate time duration it takes to perform an operation of addition
int start, finish;
clock_t start (clock()); //THIS LINE IS GIVING ME ERROR!!
c = a+b;
clock_t finish (clock()); //THIS LINE IS ALSO GIVING ME ERROR!!
cout<<"Time to calculate sum is:"<<(finish-start)/1000.0<< "seconds";
What error are you getting??? You should always quote the error the compiler, linker, debugger, or program/system reports.
But I can see you are declaring int variables called start and finish and then reusing the same names to declare clock_t variables. Removing the line int start, finish; should fix the error (which I would think is a complaint about using the same varable names).
Or you can change line 9 to: clock_t start, finish;
and then use
start = clock();
finish = clock();
PS GRex2595's suggestion is benign but unnecessary. clock() returns a value of type clock_t (clock ticks), and this line is just a cast to type clock_t (which it already is)
In my defense, I didn't realize that clock_t was a class. I thought that clock_t was a function which would lead me to believe that my line was the solution, but it's good to know that it's a class and I might be able to use this now.