Skip to content

Named constants

Mr. Daehn edited this page Aug 18, 2017 · 1 revision

Unlike variables, whose values can change during program execution, named constants have values that do not change. The declaration of a named constant is like that of an initialized variable, but the keyword const precedes the data type. For example,

const double PI = 3.14159;

declares PI as a named floating constant.