The qualifier const can be applied to the declaration of any variable to indicate that its value will not be changed. Once a variable is declared with const qualifier, it no longer remains a variable (i.e. its value can not be changed). A const must be initialized with some value.
e.g. const TYPE x = 10; //where TYPE is any data type.
const int x = 5; // This will define x as constant with value 5
Note that once const is defined, its value can not be changed by arithmetic operations or assignment.
const int x = 5; // This will define x as constant with value 5
Note that once const is defined, its value can not be changed by arithmetic operations or assignment.
What is const qualifier?
Answer - const qualifier is used to specify the variable that can’t be change throughout the program. Variable with const qualifier is often named in uppercase.

0 Comments:
Post a Comment