Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The role of define
The role of define

The following parameters have no practical significance

#define preprocessing macro definition command, its specific function is to facilitate the definition and modification of program segments.

For example, if you are working on a project, the code of this project is very long, with more than 5,000 lines, and basically the same constant N takes up more than 3,000 lines. If If you want to modify the value of this constant N in the future, if you do not define a #define N at the beginning of the program, it will not be very troublesome to change it. There are more than 3000 lines, so you will not faint ~ If you define a #define N in advance #define N 'constant value', then when you want to modify the constant value inside the program, just modifying the constant value after N is equivalent to changing the same constant value to be modified inside the program, which is very convenient

The amount whose value can change during the execution of the program is called a variable. Variable types are divided into system variables and user-defined variables. User-defined variables actually have the same meaning as system variables. When learning structured programming , you will understand the meaning of custom variables.

System variables are divided into four types: int integer variable, which is used by users to store integers and occupies 4 bytes; float single-precision floating point type, which stores decimal point values ??and occupies 4 bytes; double high-precision floating point Compared with float, double retains more precise decimal points and occupies 8 bytes; char character variable mainly stores letters and occupies 1 byte.