Difficulty: Easy
Correct Answer: None of the above
Explanation:
Introduction / Context:Numeric literals in C and C++ follow strict lexical rules. Only certain characters are permitted within the token that represents an integer or floating-point literal. Understanding which characters are allowed prevents hard-to-spot compile errors and ensures code portability across compilers and locales.
Given Data / Assumptions:
Concept / Approach:
Step-by-Step Solution:
Check each character against the lexical set for numeric literals.Comma → not allowed; Space → not allowed; $ and % → not allowed.Conclude: the correct option is ”None of the above”.Verification / Alternative check:
Try compiling 1,000 or 1 000 or $100 or 50% as literals: each fails or parses differently than intended. Use 1000, 1'000 (C++14 digit separator), or 0.5 for 50% semantics.Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
None of the above
Discussion & Comments