Measuring time taken by a function: clock_gettime

Dividing an integer by an integer yields an integer. Try this:

#define BILLION 1E9

And don’t use a semicolon at the end of the line. #define is a preprocessor directive, not a statement, and including the semicolon resulted in BILLION being defined as 1000000000L;, which would break if you tried to use it in most contexts. You got lucky because you used it at the very end of an expression and outside any parentheses.

Leave a Comment