In this article we will see a small example of using constants in c. constants are declared with a keyword const.
const float PI = 3.14 ;  //constant of type float
const char myStr[] = ” *** *** ” ;  //constant of char array 
The program below is to find the area and perimeter of circle in which we use const .
In the program below we have declared PI as a constant which value is given as 3.14
It means PI value cannot be changed either at compile time or run-time . if we try to change the value of a constant variable it gives a compile-time error.Any Integral or char/string variables can be declared as constants.

Sample Output :

c program constants output