At first, I figured they would just keep a value, but the value could change, such as
const int theconstant = num1 + num2and whenever you referred to theconstant it would give you the value of num1 + num2 even if the value of those variables had changed.
Well I decided it's about time I should look it up and learn more about constants, but it's looking like they're not as useful as I thought. I looked through a few of my programming books and it just explains constants as an integer or something that doesn't change, and they both give the example of pi=3.14.
This doesn't seem useful, as you can just make an int named pi and not change it. I have a feeling I'm not understanding something. Maybe my first guess was right?
If anyone could explain the purpose of them I'd appreciate it.


Sign In
Create Account


Back to top










