Constants in C Programming
If you want to define a variable whose value cannot be changed, you can use the const keyword. This will create a constant. For example,
const double PI = 3.14;
Notice, we have added keyword const.
Here, PI is a symbolic constant; its value cannot be changed.
const double PI = 3.14;
PI = 2.9; //Error
Comments
Post a Comment