Saturday, February 13, 2010

17

#include< stdio.h >
main()
{
int i=1;
if(++i < 1 && ++i >1)
{
printf("False");
}
printf("%d",i);
}

Output


2


How?


&&   Logical AND operator.
As far as AND operator concerned if both expression true ,it'll return true otherwise false.if first expression is false ,no need of checking the next expression.
In this program ++i < 1 is false (2 < 1, so false). so no need of checking the next expression.++i > 1 will not work. so 'i' will incremented for 1 time.
so i=2.

0 comments:

Post a Comment