What will be the output of the following code? int main () { int x = 4, y = 0;…

PYQ Infosys Hiring Test 2023

What will be the output of the following code?

int main ()

{

int x = 4, y = 0;

int z;

z = (x++ + ++y + y++ , x++);

printf ("%d\n", z);

return 0;

}

  1. A.

    5

  2. B.

    0

  3. C.

    Compiler error

  4. D.

    Undefined behaviour, as the order of evaluation can differ

Attempted by 121 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…