Constants and variables
1. Variables
(1) variable refers to the amount of variable values that can change while the program is running.
(2) assign an initial value to the variable
Type specifier variable 1 = value 1, variable 2 = value 2 ,......;
2. Constants
In contrast to the definition of a variable, a constant is the amount that cannot be changed while the program is running.
There are five types of constants: integer, real, character, string, and symbolic constant.
(1) Integer constants
An integer constant is an integer. It can be a decimal, octal (starting with 0), or a hexadecimal number (starting with 0x or 0X.
(2) real constants
A real constant is also called a floating point constant. It is a value with decimal places. The representation can be decimal or exponential.
(3) scalar Constants
Constant is a character enclosed in single quotes. These characters are generally ASCII characters whose values are the ASCII values of the character.
(4) string constants
String constants are character sequences enclosed by double quotation marks. Character string constants are strictly different from character constants. The Compiler automatically adds an empty character '\ 0' after each character string to indicate the difference.
(5) Symbolic Constants
A symbolic constant is a constant that appears in the form of an identifier. In C, the symbolic constant is defined using the compile preprocessing command # define. the symbolic constant is defined as follows:
# Define constant name value
(6) escape characters
In C, there is also a special character constant, which is a Character Sequence starting with the Backslash "\", called an escape character.
Different from common characters, escape character sequences are not expressed in the literal table but a special ASCII character. Therefore, they can also be expressed using the ASCII value of the character.
From 10-3G-He Jinchao