Wednesday, March 24, 2010

67

int main()
{
int i,j;
i=3<3+2;
j=4<<1+1;
printf("%d %d ",i,j);

return 0;
}





Output

1     16

Logic:
In c program arithmetic operators (/,*,+,-) has higher precence than the conditional operators( < , > ,< =, > =,!=,==) and shifting operators( << , >> ). so addition operation is performed first.
i=3<5 results truth value 1.
j=4<<2 results 16.(read shifting post to know about the shifting operator).

0 comments:

Post a Comment