what is the output of
for(;0;)
printf("\n guess!!");
Answer: guess!!
Its because..a for loop will always do the initialization first and executes the loop's body...ONLY after executing the loops body once,it will check for the condition..
So..in this case ...it executes loop's body once..then it finds 0(ie .false) ,hence it quits but instead of 0,any other number is considered true, hence executes infinite number of times...
for(;0;)
printf("\n guess!!");
Answer: guess!!
Its because..a for loop will always do the initialization first and executes the loop's body...ONLY after executing the loops body once,it will check for the condition..
So..in this case ...it executes loop's body once..then it finds 0(ie .false) ,hence it quits but instead of 0,any other number is considered true, hence executes infinite number of times...
No comments:
Post a Comment
Hey ther,
Thanks for visiting my blog.
Feel free to write whats in ur mind about the post you read..!! A Good day to u!!