🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Different compilers round numbers differently
  2. B.Byte order in memory (endianness) depends on the processor
  3. C.reinterpret_cast picks random bytes
  4. 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 →