Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 113

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

Answer:

main()
{
unsigned char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}


Answer
infinite loop


Explanation
The difference between the previous question and this one is that the char is declared to be unsigned. So the i++ can never yield negative value and i>=0 never becomes false so that it can come out of the for loop.

Share: 
 

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


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


Tagged: