Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is the output of this C code?    

int main()
    {
        int x = 1, y = 0;
        x &&= y;
        printf("%d\n", x);
    }

 

  • A.Compile time error
  • B.1
  • C.Undefined behaviour

Answer: A

Correct answer: Compile time error

There is no &&= operator in C. The compound assignment operators are += -= *= /= %= &= |= ^= <<= >>= - the bitwise &= exists, but the logical && has no assignment form. The program fails to compile.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.