c - Use of the while loop -
this question has answer here:
- purpose of while(1); statement in c 12 answers
i saw in lots of example form of use while loop i'm not sure it's ok use in code.
while(1){ // code lines if(condition){ break; } // code lines }
is ok use? does
while(1)
exactly mean?
is ok use? exactly
yes, , commonly used in programming.
while(1)
same while(true)
, condition thats true, ensuring while
loop never stops until manually break out of break;
there many applications behavior. exit condition complex, requires function calls, etc. want infinite loop program (for menu instance) exits on specific prompts. wether or not use often stylistic choice.
Comments
Post a Comment