Articles to prepare
- 12Number of questions
- 323Test passed (times)
- 249Users who passed the test
- 58.44Average score
- --Your average score

C++ → C++ - Tutorial 003. Constants
C =++ supports two notations of immutability:
- const - which implies that the value will not change. First of all, this is used to specify interfaces, for data that is passed to functions and methods so that they are not afraid that they will be changed. The compiler monitors the presence of the const qualifier;
- constexp - which involves calculating the constant at compile time. Used to store data in memory where they will not be damaged, and to improve performance.
For example:
const int dmv = 17; // Constant with the name dmv int var = 17; // Var is not a constant constexpr double max1 = 1.4∗square(dmv); // OK, since square (17) is a constant expression constexpr double max2 = 1.4∗square(var); // Error, because var is not a constant const double max3 = 1.4∗square(var); // OK, because the expression can be evaluated in runtime double sum(const vector<double>&); // sum will not modify its arguments vector<double> v {1.2, 3.4, 4.5}; // v is not a constant const double s1 = sum(v); // OK, it will be calculated in runtime constexpr double s2 = sum(v); // Error, sum (v) is not a constant expression.

Fornex
Let me recommend you a great European Fornex hosting.
Fornex has proven itself to be a stable host over the years.
For Django projects I recommend VPS hosting
Following the link you will receive a 5% discount on shared hosting services, dedicated servers, VPS and VPN
View HostingShare on social networks
Donate
The EVILEG project has switched to a non-commercial basis and will develop solely on the enthusiasm of the site creator, the enthusiasm of users, donations and the hosting referral system
Thank you for your support
Available ways to support the project
PayPal
PatreonYandex.MoneyMore