Variables are internally stored values and memory addresses, which can be changed at any time during program running. For example: Int A = 123, where a is an integer variable. Usually, integer variables occupy 4 bytes of memory.
During the running of the program, the value represented by the constant cannot be changed. For example, const int a = 123, where a is preceded by a modifier "const", indicating that the value of a is "read-only".
Extended data:
In C language, there are two ways to define constants: one is to use preprocessing instructions: # define and the other is to use the keyword "const".
When defining a constant, name the constant in uppercase as much as possible. This is a "default" rule, which is convenient to distinguish between "constants" and "variables" and enhances the readability of the program.
Using constants has a great advantage: when a constant is used in many places in a program, it is only necessary to modify the value of the constant where it is defined, and then the values in many places will be changed, which is very beneficial to the later maintenance of the program.
Baidu encyclopedia-unchanged
Baidu Encyclopedia-Variable