Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 87

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

Answer:

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.

Share: 
 

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


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


Tagged: