Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 102

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

Answer:

void main()
{
while(1){
if(printf("%d",printf("%d")))
break;
else
continue;
}
}


Answer:
Garbage values


Explanation:
The inner printf executes first to print some garbage value. The printf returns no of characters printed and this value also cannot be predicted. Still the outer printf prints something and so returns a non-zero value. So it encounters the break statement and comes out of the while statement.

Share: 
 

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


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


Tagged: