Let’s have a glance at the Constants in C programming language.
What Are Constants in C Programming Language?
Constants are referred to as fixed values that the program may not change during its execution.
Important things regarding Constants:
- The value of Constant cannot be altered or modified.
- It can be treated as a variable.
- It can be of any basic data types in the C programming language.
Declaration of Constants
There are 2 ways to define constants in C Programming
Using #define preprocessor directives.
The syntax of declaring constant using #define preprocessor directives.
#define Constant_Identifier Value
Using const keyword in the variable declaration.
The syntax of declaring constant using the const keyword.
const data_type variable_name = Constant;