const means "this won't be modified after initialization", but the initialization can happen at runtime: const uint32_t id = read_chip_id(); is a perfectly valid runtime-initialized constant. constexpr is stronger: it means "this is computable at compile time," so the initializer must itself be a constant expression, and the value is baked into the binary with no runtime computation. Every constexpr variable is implicitly const, but not every const is constexpr. For functions, constexpr means the function can run at compile time when given constant arguments (and at runtime otherwise). The practical distinction: use const for "read-only," use constexpr when you specifically need compile-time evaluation, a lookup table built by the compiler, an array dimension, or a value that must be a true constant expression.
C++ for Embedded · Interview question
What's the difference between const and constexpr?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
const Correctness & constexpr
const propagates read-only intent through your whole API; constexpr moves computation to compile time so lookup tables and config land in flash with zero runtime cost.