Welcome Guest | Sign in | Register
Operators - Discussion Page For Q.10667 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Operators > Questions and Answers

Q: What will the output of following C code?
main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
}
A. 0 B. -1
C. -2 D. 1

Answer and Explanation

Answer:-1

Explanation:
Unary + is the only dummy operator in C. So it has no effect on the expression and now the while loop is, while(i--!=0) which is false and so breaks out of while loop. The value –1 is printed due to the post-decrement operator.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.