Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
Practice Tech Mahindra Essay Topics

C Programming :: Declarations and Initializations - Discussion

Home > C Programming > Declarations and Initializations > MCQs Questions Discussion

9 / 54

What is the output of the following program?

#include<stdio.h>
int main()
{
int x,y=2,z,a;
x = (y*=2) + (z=a=y);
printf ("%d", x);
return 0;
}

A7

B8

C6

Dsyntactically wrong

Answer: Option (Login/Signup)

Show Explanation

x = (y*=2) (z=a=y); Meaning of y*=2 means y=y*2 hence y value becomes 2*2=4. 



Current value of y =4 so z=a=y=4.



Hence x=4+4=8

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +1 -0 +
    Report


Report Error

Please Login First Click Here

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here