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
1) Constant has type defined so it can be type checked by compilers.

2)
These constants are variables with a definite scope.

Enumerations are set of constant integer variables in C.

Comments

Popular posts from this blog

Airtel Digital tv remote factory reset and reprogram

Tracking Linux kworker threads

Asynchronus I/O (AIO) in vxworks and Linux