I was asked this question in a technical interview:
What is the difference between a
const
and a macro in C++?
My a
A macro always have a type, for instance, #define FIVE 5
is of type int.
An advantage for the const variable over the macro could be the memory usage : With a macro the value may have to be duplicated everywhere it is used will a const variable will not be duplicated in memory. (but I am not sure of this difference)