Understanding C++ string literal types
This is a medium-difficulty question on C++ language fundamentals that tests whether you understand the distinction between string literals and string objects. It is the kind of detail-oriented question that filters candidates who have only surface familiarity with the language from those who can reason precisely about types.
The question forces you to think carefully about what the compiler actually sees when it encounters a string literal in source code, rather than what you might assume based on how strings behave at runtime. Getting this right requires knowledge of how C++ represents and stores string data at the syntactic level, and how the type system exposes that distinction.
- String literal syntax and storage duration
- Array decay and pointer conversion
- Type deduction in modern C++