2. In mathematics, constants refer to unchangeable quantities, such as e, π, etc. Variables refer to quantities that can take different values (dependent variables and independent variables). Variable is the development of constant, and constant is a special case of variable. For example, y=2x+ 15, where 15 is a constant and x and y are variables (y is a dependent variable and x is an independent variable).
3. In the program, the value of the constant cannot be modified, and any attempt to modify the constant will lead to compilation errors. Variables can change their values by assigning values; Constants must be initialized when they are defined. Variables can be defined without initialization; Constants have no address attributes (except string constants, etc.). ), and variables have address attributes. Therefore, constants can only be used as right values, while variables can be used as both left and right values.