ProgrammingHard
What is -7 / 4 in C?
- A. -2
- B. -1.75
- C. -3
- D. -1
Correct answer: D. -1
C99 division truncates toward zero, so the result is -1 (the exact value is -1.75).
More C Programming questions
- unsigned char c = 0xF0; c |= 0x0F; c <<= 1; printf("%d", c); What is printed?
- What is the value of 1u << 31 >> 31 in C?
- What is printed by printf("%d", 0x7FFFFFFF + 0);?
- What value is -x when x is 7 in two's complement, expressed as ~x + 1?
- What is the value of (unsigned short)(65535 + 1) on a platform where unsigned short is 16 bits?
- Which bit trick isolates the lowest set bit of an unsigned n?