← Quiz: Type Casting in C++: all 10 questions
Quiz: Type Casting in C++ · Question 2 of 10
Which cast should you use to convert an int to a double?
Which cast should you use to convert an int to a double?
- A.static_cast
- B.dynamic_cast
- C.const_cast
- D.reinterpret_cast
Answer & explanation
Correct answer: static_cast
Number conversions are ordinary compile-time conversions, the job of static_cast.
Can you get the rest right without peeking?
Take the timed Quiz: Type Casting in C++ quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →