Back to course

Constants in C++

C++ Masterclass: From Zero to Hero

Constants use the const keyword. Their value cannot be changed after declaration. cpp const double PI = 3.14159;

Attempting to change PI will cause a compiler error.