Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 108

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 69

Answer:

main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
}


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.

Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 108 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: