Tuesday 19 March 2013

for(i=1;i>-2;i--)


    main(){
 unsigned int i;
 for(i=1;i>-2;i--)
             printf("c aptitude");
}
Explanation:
i is an unsigned integer. It is compared with a signed value. Since the both types doesn't match, signed is promoted to unsigned value. The unsigned equivalent of -2 is a huge value so condition becomes false and control comes out of the loop.


Blog Author: Vijay Kumar

Go to: Java Aptitude

No comments:

Post a Comment