Showing posts with label What is constant. Show all posts
Showing posts with label What is constant. Show all posts

What is a constant? Write are the different type of constants in C language?

What is a Constant?

In C programming language and other languages, constants are variables with a exception that the value of a constant can be set only once and can not be modified later. This exception differs a constant variable from other variables and are called constant because their values are not variable. Value of a constant can not vary during the execution of a program, thus it can not be called a variable.

Using constants for unchangeable values ensure that the value remains the same over the period of execution, will not change mistakenly.
In programs which embeds third party codes or scripts, constants make sure that the value will not be changed by third party codes intentionally or mistakenly.