Difference Between #define and const?
Although they can be used for same purpose,constants are a useful feature that can prevent program bugs and logic errors. Unintended modifications are prevented from occurring. The compiler will catch attempts to reassign new values to constants.
There are three main difference between them
-
Constant has type defined so it can be type checked by compilers.
-
These constants are variables with a definite scope.
Enumerations are set of constant integer variables in C.