CONSTANT AND LITERALS IN C

Constants  In C Programming Language are referred to be fixed values that cannot be altered during execution of the program.

Note : Fixed values are also known as Literals

There are few important things regarding Constants n C programming

  • Value of Constant cannot be altered or modified.
  • It can be treated as variable.
  • It can be of any basic data types in C programming language.

Declaration of Constants in C

There are 2 ways to define constants in C Programming

1. By using #define preprocessor directives.

Syntax of declaring constant using #define preprocessor directives.

 #define Constant_Identifier Value

2. By Using const keyword in variable declaration.

Syntax of declaring constant using const keyword

const data_type variable_name = Constant;

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *