Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 103

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

Answer:

main()
{
unsigned int i=10;
while(i-->=0)
printf("%u ",i);

}


Answer:
10 9 8 7 6 5 4 3 2 1 0 65535 65534…..


Explanation:
Since i is an unsigned integer it can never become negative. So the expression i-- >=0 will always be true, leading to an infinite loop.

Share: 
 

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


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


Tagged: