While programming you might need to store certain values which do not change throughout the program. For example, in mathematical formulae for calculating the area and perimeter of a circle we need the value of PI to be same. Such values are maintained as constants. A constant is similar to a variable in the sense it is a placeholder in memory. Only difference is value of a constant cannot be changed once initialized. Constants in C++ can be: Literal constants (ex: 2, 5.6, ‘a’, “hi” etc.) Declared constants (using const keyword) Constant expressions (using constexpr keyword) Enumerated constants (using
The post what are different constants in C++ appeared first on Coding Security.
what are different constants in C++
read more
Tidak ada komentar:
Posting Komentar