Register
 

Free CSC Scholarship support for 2018-19

Engineering, Computer, Scholarship and SEO Support Forum



Author Topic: The following code fragment int x, y = 2, z, a;  (Read 490 times)

Offline mechanic

  • Engineer
  • Hero Engineer
  • *****
  • Posts: 3035
    • View Profile
    • Engineering Forum
The following code fragment int x, y = 2, z, a;
« on: February 26, 2017, 07:44:45 PM »
Advertisement
Question: The following code fragment

int x, y = 2, z, a;
x = {y *= 2} + [z = a = y};
      printf {*&d", x};

Options are:

A. prints 8
B. prints 6
C. prints 6 or 8 depending on the compiler implementation
D. is syntactically wrong

Correct answer is:

C. prints 6 or 8 depending on the compiler implementation


Engineering, Computer, Scholarship and SEO Support Forum

The following code fragment int x, y = 2, z, a;
« on: February 26, 2017, 07:44:45 PM »