Question 6
Back to Exercise
What happens with int x{7.9};?
- A x becomes 7
- B x becomes 8
- C Compilation error: narrowing conversion from double to int Correct
- D x becomes 0
Correct Answer: Option C
Brace initialization forbids narrowing conversions. int x = 7.9; would compile (with a warning) and store 7.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!