As the name suggests, a constant in C is a variable that cannot be modified once it is declared in the program. We can not make any change in the value of the constant variables after they are defined.
Types of constants In C
Syntax to define constant
const data_type var_name = value;
Examples :
Defining using #define preprocessor
We can also define a constant in C using #define preprocessor. The constants defined using #define are macros that behave like a constant. These constants are not handled by the compiler, they are handled by the preprocessor and are replaced by their value before complication.
Program:
Program.c
Resources :
Test Your Knowledge
Choose The
With supporting text below as a natural lead-in to additional content.