A constant is defined as the amount that will not be modified at runtime.
In C, constants are defined using # define. In C ++, since C ++ is compatible with C, # define in C can be used to define constants, you can also use the const in C ++ to modify the variable to make it a constant.
It can be said that the constant defined in C language is defined by # define, but the constant defined by # define does not have any type information, which may cause insecurity.
Constants in C ++ are defined using const, and constants in C ++ have type information, so they are safer.
Volatile:
Volatile is the opposite of Const. The variable is modified using volatile, which indicates that the variable is variable-prone and tells the compiler not to optimize the reading of the variable. If you want to reference a variable modified by volatile, you need to re-read the value of the variable, instead of using the value last read.
Cpp_syntax _ constant