Sunday 24 March 2013

for(;i>=0;i++) ; (2)


 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.


Blog Author: Vijay Kumar

No comments:

Post a Comment