Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to define constants in C language?
How to define constants in C language?
There are two common methods to define constants in C language:

The first type: macro definition

#define N 3 // define a macro n with a constant of 3, which represents 3 in the program.

The second type: initialize and assign values to variables.

int a = 2; //Define an int variable and assign it to 2. In fact, this is to define a constant with a variable.

Note: Constants are still defined by macros.