A constant is a variable whose value cannot be changed after its definition. Constants in C are the fixed values and its value remains unchanged during the entire execution of the program. Generally, we use const keyword to create a constant.

const double PI = 3.14;

There are two Ways in C to define constants

  1. Using const keyword.
  2. Using #define preprocessor.
  • Constants are also called literals.
  • Constants can be any of the data types.
  • We can also define a constant using the #define preprocessor directive.

Sharing is Caring
Load WordPress Sites in as fast as 37ms!
Scroll to Top