+ 5
What is the difference between #define and const in C++?
#define MAX 10 and const int MAX = 10 have the same value but are you supposed to use one over the other? Are there pros and cons to them? Or is it just user preference?
2 odpowiedzi
+ 7
The one place that makes a huge difference between them is:
int array[MAX];
The define is legal to be used in this case. While some compiler's do allow it, the usage of the constant is not supported by the current standard.
+ 5
Three is no big difference between them, there are in compile time and how to check data types and handle there values!
read this :
https://stackoverflow.com/questions/6442328/what-is-the-difference-between-define-and-const