← Quiz: Type Casting in C++: all 10 questions
Quiz: Type Casting in C++ · Question 10 of 10
Why does the byte-printing reinterpretcast example print different results on different machines?
Why does the byte-printing reinterpret_cast example print different results on different machines?
- A.Different compilers round numbers differently
- B.Byte order in memory (endianness) depends on the processor
- C.reinterpret_cast picks random bytes
- D.int is always 2 bytes on some machines
Answer & explanation
Correct answer: Byte order in memory (endianness) depends on the processor
Little-endian machines store the lowest byte first; big-endian machines store it last.
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 →