Home Contact About

Declaring a variable as Constants




We may like the value of certain variables to remain constant during the execution
of a program. we can achive this by declaring the variables with the qualifier const
at the time of initialization.
Example :
const int class_size = 40;

const is a new data type qualifier defined by ANSI standards. THis tells the compiler that the int variable class_size must not be modified by the program .