ProgrammingVery hard

What is (-8) >> 1 in C if the platform uses arithmetic right shift for signed values?

  1. A. It is always -4 by the C standard
  2. B. It is always 2147483644
  3. C. It is always 0
  4. D. The result is implementation-defined, so the standard does not fix its value

Correct answer: D. The result is implementation-defined, so the standard does not fix its value

Right shifts of negative signed values are implementation-defined in C. Arithmetic shift gives -4, but the standard does not require it.

More C Programming questions

Exams that ask this topic