Constants in C

Spread the love

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.

Disclosure: This website is supports by its reader. This means, if you buy any product / service through link on this website, we may earn a small commision withought costing you extra. Learn how you can support Us and why we need this?