Friday, February 15, 2013

Predict the output or error(s) for the following


Predict the output or error(s) for the following

main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
}
Answer:



i=0
Explanation:
In the expression !i>14 , NOT (!) operator has more precedence than ‘ >’ symbol. ! is
a unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).

No comments:

Post a Comment