some programming languages require that named constants are assigned a value when they are declared. Other languages allow a constant’s value to be assigned later in a program. Which requirement do you think is better? Why?
The one where we have to assign the value when they are declared is better because if the value is a constant then it must be known at the time of the declaration otherwise there is no point of declaring the variable if its not going to be used in code or if we don't know the value of variable yet. If we don't know the value then we can't use it hence it becomes a redundant variable unless assigned a value so we can declare it at that time only when we know the value of the constant.
Get Answers For Free
Most questions answered within 1 hours.