What is the difference between typedef and Macros? We can just simply define a macro instead of using a typedef, and what does this Macro evaluate to CLOCKS_PER_SEC (defined in <ctime>)?
Asked
Active
Viewed 506 times
1
Donald Duck
- 8,409
- 22
- 75
- 99
AnotherOne
- 854
- 2
- 8
- 19
-
1`CLOCKS_PER_SEC` is supposed to be a type? – LogicStuff Mar 01 '16 at 21:03
1 Answers
1
A macro is a text substitution performed by the preprocessor before compilation begins.
A typedef can be thought of as a synonym.
The macro CLOCKS_PER_SEC looks like it is an identifier that evaluates to some number for compilation.
On some platforms, CLOCKS_PER_SECOND is the number of clock ticks per second or the number of clock cycles per second. It is a measure of time or performance.
Thomas Matthews
- 56,849
- 17
- 98
- 154