All challenges
Multiple ChoiceBeginner 45s

constexpr vs const

What is the key difference between `const` and `constexpr`?
Options
  1. 1`constexpr` requires compile-time evaluation where possible; `const` only means runtime-immutable after initialization.
  2. 2They are identical in every respect; constexpr is just a deprecated synonym for const.
  3. 3`const` guarantees compile-time evaluation of the initializer, while constexpr does not.
  4. 4A constexpr variable may be freely modified at runtime, unlike an ordinary const variable.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle