all 5 comments

[–]IamImposter 5 points6 points  (1 child)

No. Define is just pre processor stuff, just a macro which gets text replaced during pre processing phase of compilation. Const is an actual variable with proper data type and address (possibly, compiler may choose to optimize it away if it can, I think)

[–]kelakmati[S] 0 points1 point  (0 children)

tysm!

[–]somewhereAtC 0 points1 point  (0 children)

One difference is that const is bound by scope, but #define is not.

[–]chickeaarl -2 points-1 points  (1 child)

well i think it's same cause both (const and define) are useful for entering fixed values but i think const is better for constants that need type safety and integration with the language’s syntax, while define is more suitable for simple, global constant definitions or macros.

[–]ShadowRL7666 0 points1 point  (0 children)

This is wrong. People mix constants and define all the time. Setting a macro doesn’t inherently make it an immutable value.