"const" Keyword Explained
Feb 10, 2009, 09:02 (0 Talkback[s])
How to Help Your Business Become an AI Early Adopter
[ Thanks to An Anonymous Reader for
this link. ]
"You'd be quick to point out (correctly) that the above
code wouldn't compile. It would fail with an error on the lines of
"assignment of read-only variable a" because a is now a "constant"
because of the const type qualifier attached to it. And now comes
the issue. Many start assuming (or might even be explicitly taught)
that the value of a cannot be changed now. Did you think so too?
Well, you thought wrong. Look at the following code:"