Tuesday 19 March 2013

if(i && j++)


main()
{
 int i =0;j=0;
 if(i && j++)
   printf("%d..%d",i++,j);
printf("%d..%d,i,j);
}
Answer:
0..0
Explanation:
The value of i is 0 i.e. false for if. Since this information is enough to determine the truth value of the boolean expression. So the statement following the if statement is not executed.  The values of i and j remain unchanged and get printed.


Blog Author: Vijay Kumar

Go to: Java Aptitude


No comments:

Post a Comment