Multiple choice

void main() { char x=260; int i; i=x + !x + ~x + ++x; printf("%d", i); }

    • 5
  1. 4

  2. Lexical error

    • 6
  3. Syntax error

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Char a = 260. 260 is beyond the range of signed character. Its corresponding cyclic value is -6. a = -6. Operator !, ~ and ++ have equal precedence. First ++ operator performs, so its value is -5. i = -5 + !-5 + ~5 + -5 = -5+0+4-5 = -6.