const keyword

In the C++ world, the use of const is considered to be an improvement over #define in general the usual C programming rules apply. There is one exception within a class, this is because the class syntax does not allow the assignment of a variable when it is declared. The result is a rather strange looking syntax. Please see the example below.


o Example program.

See Also:

C References

o C version of const.
o Theory of constants.