Difficulty: Easy
Correct Answer: 'multi char'
Explanation:
Introduction / Context:In C and C++, a string constant (string literal) is a sequence of characters enclosed in double quotes. It produces an array of characters terminated by a null character. This question asks you to identify which presented token is not a valid string literal, ensuring clarity about the difference between character and string constants.
Given Data / Assumptions:
Concept / Approach:
Step-by-Step Solution:
Inspect option A: "Hello, world!" → valid string literal.Option B: "7.15 pm" → valid string literal with digits, dot, and space.Option C: 'multi char' → uses single quotes and multiple characters → not a string literal; not a standard single character literal either.Option D: "i like e" → valid string literal.Option E: "1234e12" → still a string literal; numeric-like content does not change the type.Verification / Alternative check:
Compile-time types: options A, B, D, E have type const char[N]; option C would be an implementation-defined multi-character literal of type int (not a string), or rejected under strict rules, hence invalid as a string constant.Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
'multi char'
Discussion & Comments