Friday 22 March 2013

if(x=y%2) z=2;


    #include<conio.h>
main()
{
    int x,y=2,z,a;
    if(x=y%2) z=2;
    a=2;
    printf("%d %d ",z,x);
}
 Answer:
Garbage-value 0
Explanation:
The value of y%2 is 0. This value is assigned to x. The condition reduces to if (x) or in other words if(0) and so z goes uninitialized.

Blog Author: Vijay Kumar

No comments:

Post a Comment